Saturday, September 28, 2013

Easy steps to create a JQuery Plug-in


1. Prepare Plugin declaration skeleton:

jQuery.fn.yourmethodname = function(params) { ... };

2. Write your code logic in the below script

(function($) {
    $.fn.yourmethodname = function(params)

               { add your code logic here...............}
})(jQuery);


3. Save this file as jquery.yourmethodname.js.

4. Call the method in your HTML file

$("some element").yourmethodname();

No comments:

Post a Comment