Skip to content
This repository
Fetching contributors…

Cannot retrieve contributors at this time

file 53 lines (50 sloc) 1.68 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
<?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>
Something went wrong with that request. Please try again.