Creating Custom jQuery Plugins — a practical guide to create jQuery plugin with clear examples you can reuse in real projects.
jQuery Tutorial Series (81/101). Prefer one article? Read the complete jQuery tutorial.
Short description
Keep one responsibility per plugin; document the public API.
Plugin sketch
(function ($) {
$.fn.highlight = function (color) {
return this.css('background-color', color || '#fff3cd');
};
})(jQuery);
$('.note').highlight();