Home  >  jQuery

Example of callbacks.has() in jQuery

March 30, 2013
has() in jQuery is called on callback list. has() checks whether given callback function is available in callback list or not. In code it is used as
callbacks.has( function_name )
 
Find the sample example.

<html>
<body>

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

<script>

var cal = function(a,b) {
	console.log(a+b);
};

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

var callbacks = $.Callbacks();

callbacks.add( cal );

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

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

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


Output
true
false
 
FIND MORE TUTORILAS






©2019 concretepage.com | Privacy Policy | Contact Us