ui.selectmenu投掷'this.newelement.0'为null或不是对象

ui.selectmenu throwing 'this.newelement.0' is null or not an object

本文关键字:null 对象 newelement selectmenu 投掷 this ui      更新时间:2023-09-26

我正试图从这里实现ui.selectmenuhttp://filamentgroup.com/lab/jquery_ui_selectmenu_an_aria_accessible_plugin_for_styling_a_html_select/,但将其放置在jQuery对话框中。不确定这是否是冲突的根源。

HTML标记为:

<div id="selModeBox" title="Mode selection Form">
    <label for="mode">Select modes:</label>
    <select id="mode" name="mode">
        <option value="v0" selected="selected">-- Make a Selection --</option>
        <option value="v1">Mode 1.</option>
        <option value="v2">Mode 2.</option>
    </select>
</div>

要实现的Javascript:

jQuery(document).ready(function() {
    $('#selModeBox').dialog({
        modal: true
    });
    $('#selModeBox select').selectmenu();
    $('#tabs').tabs();
});​

javascript错误出现在加载时,指的是ui.selectmenu javascript代码的这一行(第108行):

this.element.click(function() {
    this._refreshValue();
}).focus(function() {
    this.newelement[0].focus();
});​

有没有人经历过类似的事情,或者有任何补救的想法?

jQuery 1.8可能是由于尚未测试而导致问题,请参阅https://github.com/fnagel/jquery-ui/issues/261

如果问题在1.7.x中仍然存在,请打开新的问题(请参阅https://github.com/fnagel/jquery-ui/issues/61)