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 the static function.
jQuery.isFunction( object )
Parameters
Parameters
Description
object Any value of any type 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. For more information, please follow other related articles on the PHP Chinese website!