tags:

views:

55

answers:

3

Can someone explain the below,

$.myfunc.extend({

    gethtml: function (id, access, html, myfunc_change, myfunc_replace) {
    },....

});

what is extend ,gethtml, myfunc in the code and how is the function accessed

Thanks..

A: 

The code assumes that my func is an object that gets extended. I.e. myfunc.gethtml(...) should get you access to the function you defined.

See JQuery.extend() for further detail.

Obalix
+2  A: 

The extend method will extend myfunc and add the gethtml method to it. You will be then able to call:

$.myfunc.gethtml(...)

id, access, html, myfunc_change, myfunc_replace are all arguments to the gethtml method. You need to look at the implementation to see what they do. The last two are probably callback methods.

kgiannakakis
A: 

At the heart of this is the idea that myfunc is (presumably) a function, but functions are also objects, and as objects, can have member functions of their own.

It's a bit of a funky concept to wrap your mind around, but is used a lot in modern javascript programming (particularly with jQuery)

James Curran