Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0Digg thisPin on Pinterest0Email this to someone

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

};
If you enjoyed this post, why not leave a comment or consider a Donation as a token of your appreciation. If you need help implementing something you saw on this site or any other project why not Hire Me?
How to: Javascript Stop Function from Outside Function
Tagged on:                                 

Leave a Reply

Your email address will not be published. Required fields are marked *

Loading Facebook Comments ...