开发者

simplest way to create an extension function using Jquery

What is the simplest way to create an extension function or method using Jquery. I am finding it really difficult to create my own property using Jquery.开发者_如何学JAVA

e.g

$("#selector").myproperty({para1:val1});


The simplest way is to just create a plugin:

$.fn.myproperty = function ( opts ) {
    // within the plugin:
    // this === $('#selector')
    // opts.para1 === val1
};

when you invoke it using $('#selector').myproperty({para1:val1})

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜