jQuery.isFunction() function is used to determine whether the specified parameter is a function.
This function belongs to the global jQuery object.
Syntax
jQuery 1.2 adds this static function.
jQuery.isFunction( object )
Parameters
Parameter Description
object Any type of any value that needs to be judged.
Return value
jQuery.isFunction()The return value of the function is of Boolean type. If the specified parameter is a JS function object, it returns true, otherwise it returns false.
Example & Description
The jQuery sample code for the jQuery.isFunction() function is as follows:
//在当前页面内追加换行标签和指定的HTML内容 function w( html ){ document.body.innerHTML += "<br/>" + html; } function foo(){ alert("CodePlayer"); } w( $.isFunction( foo ) ); // true w( $.isFunction( function(){ } ) ); // true w( $.isFunction( new Function("x", "y", "return x + y;") ) ); // true w( $.isFunction( null ) ); // false w( $.isFunction( true ) ); // false w( $.isFunction( { } ) ); // false w( $.isFunction( [ ] ) ); // false
The above is the detailed content of Detailed explanation of jQuery.isFunction() function usage examples. For more information, please follow other related articles on the PHP Chinese website!