How to create jQuery functions? -


i have seen few different approaches create jquery(-namespaced) functions, cannot quite tell actual difference between them.

jquery.fn.myfunction = function() { ... };

jquery.myfunction = function() { ... };

jquery.fn.extend({ myfunction: function() { ... } });

jquery.fn.myfunction use create functions available on every jquery result set:

$('div').myfunction(); 

jquery.myfunction use create helper functions available on jquery object, such $.inarray

your last version extends $.fn object new function, , such functional equivalent of first example.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -