Latest web development tutorials

jQuery callbacks.has () method

jQuery Misc Methods jQuery Misc Methods

Examples

Use callbacks.has () to check whether to add the list had a callback

$ (Function () { // Will be added to the list a simple function var foo = function ( value1, value2 ) { alert ( "Received:" + value1 + " ," + value2 );}; // A second function which will not be added to the list var bar = function ( value1, value2 ) { alert ( "Foobar" );} var . callbacks = $ Callbacks (); // add the function to the list callbacks. add ( foo ); Alert ( callbacks. has ( foo ) ); // True alert ( callbacks. has ( bar ) ); // False })

try it"

Definition and Usage

callbacks.has () function is used to determine whether to add the callback list through a callback function.


grammar

callbacks.has( callback )

参数 描述
callback Function类型 用来查找的回调函数


jQuery Misc Methods jQuery Misc Methods