Testing Callback Functions with jQuery.isFunction - J Query

Problem
You have written a plugin and need to test whether one of the settings is a valid call back function.

Solution

Discussion
While the JavaScript language provides the type of operator, inconsistent results and edge cases across web browsers need to be taken into account. jQuery provides the .is Function() method to ease the developer’s job. Worth pointing out is that since version 1.3, this method works for user-defined functions and returns inconsistent results with built-in language functions such as this:


which returns false in versions of Internet Explorer.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

J Query Topics