jQuery plugin skel


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. (function($) {
  2. $.fn.PLUGIN_NAME = function(options) {
  3. var opts = $.extend({}, $.fn.PLUGIN_NAME.defaults, options);
  4. return this.each(function() {
  5. $this = $(this);
  6.  
  7. $this.css({ 'color': opts.color });
  8. $this.html($.fn.PLUGIN_NAME.METHOD(opts.text));
  9. });
  10. };
  11.  
  12. $.fn.PLUGIN_NAME.METHOD = function(txt) {
  13. return txt;
  14. };
  15.  
  16. $.fn.PLUGIN_NAME.defaults = {
  17. color: 'red',
  18. text: 'Hello world! '
  19. };
  20. })(jQuery);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.