如何编写自定义函数以附加到jQuery选择器?类似下面这样的函数:
$('.my_class').my_function();
$('.my_class').my_function();
你想要向jQuery.fn
(它是jQuery对象原型的引用)添加函数。了解更多细节,请查看:
http://docs.jquery.com/Plugins/Authoring
一个示例:
(function($){
$.fn.my_function = function(){ ... };
})(jQuery);