用props扩展jQuery类?

时间:2013-11-14 22:23:42

标签: javascript jquery class

我无法使用object中的属性扩展jQuery类。 我需要那个工作:

extend = function(bc,props){}

示例必须正常工作:

var superDiv = extend(jQuery, {
         constructor: function() {
                  // call superclass constructor, if not called it's not call jquery constructor
                  superDiv.superclass.constructor.call(this, '<div />');
                  // fires
                  alert('div was successful created!');
         },

         magic: function() {
                  this.addClass('magic-div');
                  return this;
         }
});

(new superDiv()).html('Hello world!').magic().appendTo(document.body);

0 个答案:

没有答案