在IE中使用jQuery UI Selectmenu插件时出错

kra*_*626 7 html javascript jquery jquery-ui jquery-plugins

jQuery UI Selectmenu插件,在这里演示:http://jquery-ui.googlecode.com/svn/branches/labs/selectmenu/index.html

我对这个插件有几个问题.我将专注于只在IE中发生的一个.

我有html:

<label for="SearchState"></label>
<select style="width: 160px" name="SearchState" id="SearchState">
   <option>CT</option>
   <option>MA</option>
   <option>NH</option>
</select>
Run Code Online (Sandbox Code Playgroud)

和jQuery:

$('select#SearchState').selectmenu();
Run Code Online (Sandbox Code Playgroud)

在Firefox中这是有效的,但是在IE中我在加载时出错:

"Invalid argument" - jquery 1.4.2 Line: 4618

然而新样式的selectmenu与原始的一起出现(这是设计,但原始的html选择菜单应该被隐藏),但是当我点击一个选项时,我得到了以下几个错误:

"this._optionList"为null或不是对象 - ui.selectmenu.js第400行

任何想法为什么这在IE中不起作用?

ui.selectmenu.js的第399-401行

_selectedOptionLi: function() {
    return this._optionLis.eq(this._selectedIndex());
},
Run Code Online (Sandbox Code Playgroud)

jquery-1.4.1.js的第4615-4622行

name = name.replace(rdashAlpha, fcamelCase);

if ( set ) {
    style[ name ] = value;
}

return style[ name ];
Run Code Online (Sandbox Code Playgroud)

Tyl*_*ton 3

我确认了这个行为。我在这个 jsfiddle中重新创建了它。将 jQuery 升级到 1.7.2 后,没有出现这些错误。在这个jsfiddle中是固定版本。请注意,我还将 jQuery UI(因为 jsFiddle)升级到了 jQuery UI 1.8.18,但问题出在您使用的 jQuery 版本上。我建议更新到最新(稳定)版本的jQuery 和 jQuery UI以及 selectmenu (JavaScriptCSS)。