我是 JQuery & Html 的初学者。我正在创建一个名为讨论向导的小部件。运行时,出现以下错误:Object [object Object] has no method 'discussionwidget'
不确定,可能是什么原因:请帮助:
小部件代码:
(function ($, undefined) {
$.widget('ui.discussionwidget', {
options: {
userName : 'Arti Agarwal',
title:"",
width:"",
containerClass:".ui-content-gutter"
},
_create: function () {
//Create the structure of Discussion Widget
var widgetStructure = '<div class="ui-discussion hGridPx_120 wGridPx_10"><div class="ui-discussion-header hGridPx_18 wGridPx_10"></div><div class="ui-discussion-container hGridPx_100 wGridPx_75"><div class="ui-discussion-messages hGridPx_75 wGridPx_74"> <ul id="ui-discussion"></ul></div> <div class="ui-discussion-input hGridPx_10 wGridPx_10"><label class="input hGridPx_10 wGridPx_60"><span>Add or reply to a comment...</span><textarea id="message" class="hGridPx_10 wGridPx_60"></textarea></label><div class="ui-discussion-send hGridPx_10 wGridPx_10"><a href="#" id="addchat"><span class="ui-image-addchat">Add</span></a> <a href="#" id="replychat" class="ui-reply-disabled"><span class="ui-image-replychat">Reply</span></a></div></div></div></div>';
widgetStructure.appendTo($($(this.options.containerClass));
},
widget: function () {
return this.element;
},
});
var CloseDiscussionWidget = function() {
}
})(jQuery);
我从一个页面调用它:
<script>
(function ($) {
//Load discussion history fist time
$(document).ready(function () {
GetCurrentUserDetails('arti.agarwa');
Discussionwidget = $('.ui-content-gutter').discussionwidget({ containerClass: ".ui-content-gutter" });
} (jQuery));
</script>