jQuery: extend plugin question

Posted by Fuxi on Stack Overflow See other posts from Stack Overflow or by Fuxi
Published on 2009-12-11T01:52:24Z Indexed on 2010/05/02 21:08 UTC
Read the original article Hit count: 213

Filed under:
|
|

hi all,

i'm having this simple plugin code:

(function ($) {
  $.fn.tWeb = function () 
  {
    var me = this;
    me.var1 = "foo";

    this.done = function()
    {
    	return this;
    }
    return this.done();
  };

})(jQuery);

var web = new jQuery.fn.tWeb();
alert(web.var1);

works nice - alert(web.var1) is giving me "foo".

my question: would it be possible extending this plugin by simply including another .js which has more code? eg. that i could ask for web.var2

i previously used a prototype function and could "extend" it by simply adding another js-include which refered to it eg. like tWeb.prototype.newfunction = function()

how could this be done with jQuery?

thx

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about extend