jQuery.isFunction()    **DEPRECATED 3.3** JQ Home  <<  Utilities  <<  jQuery.isFunction()

Function detection.

Description

The jQuery.isFunction() jQuery Type utility method, returns a boolean dependant upon the specified object having been created as a Function JavaScript object.

Shorthand version $.isFunction()

This method was deprecated in jQuery 3.3.

Syntax

Signature Description
jQuery.isFunction( object )Return a boolean dependant upon the specified object having been created as a Function JavaScript object.

Parameters

Parameter Description Type
objectThe object to test to see if it is a Function JavaScript object.PlainObject

Return

A Boolean object.

jQuery.isFunction( object ) Example Utilities  <<  Top

Return a boolean dependant upon the specified object having been created as a Function JavaScript object.

In the example below when we press the button we create some variables and test to see if they are Function JavaScript objects.


$(function(){
  $('#btn4').one('click', function(){
    var obj1 = 'aaa', obj2 = new Function('a', 'return a * a'), obj3 = {}, obj4 = new Object;

    $('#div4').append('Is obj1 a function? ' +  $.isFunction(obj1) + '<br>');
    $('#div4').append('Is obj2 a function? ' +  $.isFunction(obj2) + '<br>');
    $('#div4').append('Is obj3 a function? ' +  $.isFunction(obj3) + '<br>');
    $('#div4').append('Is obj4 a function? ' +  $.isFunction(obj4) + '<br>');
    $('#div4').append('Is function(){} a function? ' +  $.isFunction(function(){}) + '<br>');
  });
});

div4. Some initial text.

Press the button below to action the above code:

Related Tutorials

jQuery Intermediate Tutorials - Lesson 10 - jQuery Copy, Data & Type Utilities