Mask Mask - 1 year ago 80
jQuery Question

How to add a function to jQuery?

What's the easiest way to define a new jQuery member function?

So that I can call something like:


Answer Source

Please see Defining your own functions in jQuery:

In this post i want to present how easy define your own functions in jQuery and using them.

From the post:

jQuery.fn.yourfunctionname = function() {
    var o = $(this[0]) // It's your element

    return this; // This is needed so others can keep chaining off of this


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download