Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (50 sloc) 1.68 kb
<?xml version="1.0"?>
<entry type="method" name="jQuery.isFunction" return="boolean">
<title>jQuery.isFunction()</title>
<signature>
<added>1.2</added>
<argument name="obj" type="PlainObject">
<desc>Object to test whether or not it is a function.</desc>
</argument>
</signature>
<desc>Determine if the argument passed is a Javascript function object. </desc>
<longdesc>
<p><strong>Note:</strong> As of jQuery 1.3, functions provided by the browser like <code>alert()</code> and DOM element methods like <code>getAttribute()</code> are not guaranteed to be detected as functions in browsers such as Internet Explorer.</p>
</longdesc>
<example>
<desc>Test a few parameter examples.</desc>
<code><![CDATA[
function stub() {
}
var objs = [
function () {},
{ x:15, y:20 },
null,
stub,
"function"
];
jQuery.each(objs, function (i) {
var isFunc = jQuery.isFunction(objs[i]);
$("span").eq(i).text(isFunc);
});
]]></code>
<css><![CDATA[
div { color:blue; margin:2px; font-size:14px; }
span { color:red; }
]]></css>
<html><![CDATA[
<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>
]]></html>
</example>
<example>
<desc>Finds out if the parameter is a function.</desc>
<code><![CDATA[$.isFunction(function(){});]]></code>
<results><![CDATA[true]]></results>
</example>
<category slug="utilities"/>
<category slug="version/1.2"/>
</entry>
Jump to Line
Something went wrong with that request. Please try again.