如何扩展jQuery UI widget _create方法?

Eri*_*AND 5 jquery-ui

我尝试做一些非常简单的事情有很多痛苦:扩展一个jQuery UI小部件,即自动完成的小部件.

这是我在做的事情:

(function($) {
    $.widget("my.autocomplete", $.extend({}, $.ui.autocomplete.prototype, {     
        _create: function() {
            $.Widget.prototype._create.apply(this, arguments);
        },
    }));
})(jQuery);
Run Code Online (Sandbox Code Playgroud)

当然,即使它正是官方jQuery UI文档推荐的内容,它也不起作用:

http://jqueryui.com/docs/Developer_Guide

有人可以帮忙吗?我很困惑,现在被困了好几个小时......

谢谢提前,

埃里克.

Eri*_*AND 6

好吧,经过几个小时的混乱后我找到了答案:

$.ui.autocomplete.prototype._create.apply(this, arguments);
Run Code Online (Sandbox Code Playgroud)

代替 :

$.Widget.prototype._create.apply(this, arguments);
Run Code Online (Sandbox Code Playgroud)

像魅力一样工作......