Home  >  jQuery

Example of callbacks.empty() in jQuery

March 30, 2013
empty() in jQuery is called on callback list. empty() deletes all the callback added in callback list. It is called as
callbacks.empty();
 
Find the sample example.

<html>
<body>

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>

<script>

var show = function( val ) {
	console.log(val);
};
var callbacks = $.Callbacks();

callbacks.add( show );

callbacks.fire( "hello" );

callbacks.empty();

console.log( callbacks.has(show) );

</script>
</body>
</html>

Output
In Console output will look like
Hello
false
 
FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us