jQuery.isFunction () method
Examples
Test parameters as a function of whether
<Div> jQuery.isFunction (objs [0 ]) = <span> </ span> </ div>
<Div> jQuery.isFunction (objs [1 ]) = <span> </ span> </ div>
<Div> jQuery.isFunction (objs [2 ]) = <span> </ span> </ div>
<Div> jQuery.isFunction (objs [3 ]) = <span> </ span> </ div>
<Div> jQuery.isFunction (objs [4 ]) = <span> </ span> </ div>
<Script> $ (function () {
function stub () {}
var objs = [
function () {}, { x: 15, y: 20 }, Null, stub, "function "
];. $ Each ( objs, function ( i ) {
var isFunc = $. isFunction ( objs [ i ]); $ ( "Span" ). Eq ( i ). Text ( isFunc );});}) < / Script>
try it"
Definition and Usage
$ .isFunction () Function is used to determine whether the specified parameter is a function.
Note: The version 1.3 after jQuery, for example, in Internet Explorer, the function alert provided by the browser (), and DOM element methods (eg getAttribute ()) will not be considered a function.
grammar
$.isFunction( object )
参数 | 描述 |
---|---|
object | 任意类型 需要进行判断的任意值。 |
More examples
Determines whether the specified parameters
Determine whether the argument passed to the function.