The only real way to stop an ongoing Javascript Function from outside the function is to set a var that is checked inside the function and then trigger a return

See example below on how to stop an ongoing Javascript Function from Outside the Function:

// set setStopVar
var setStopVar = '';

// START FUNCTION - setStopVar
function setStopVarFunction(){	
	
	// set stopVar
	setStopVar = true;

};
// END FUNCTION - setStopVar
                   
function function(){
	
	// START IF - check if setStopVar is true - else run function
	if (setStopVar == true){
		return;
	};
	// END IF - check if setStopVar is true - else run function

};
How to: Javascript Stop Function from Outside Function
Tagged on:                                 

Leave a Reply

Your email address will not be published.