admin管理员组

文章数量:1426027

The jQuery UI Selectmenu plugin, demoed here: .html

I am having a couple of problems with this plugin. I'll focus on just one that only happens in IE.

I have html:

<label for="SearchState"></label>
<select style="width: 160px" name="SearchState" id="SearchState">
   <option>CT</option>
   <option>MA</option>
   <option>NH</option>
</select>

and jQuery:

$('select#SearchState').selectmenu();

In Firefox this works, however in IE I get error on load:

"Invalid argument" - jquery 1.4.2 Line: 4618

However the new styled selectmenu appears along with the original one (this is by design, but the original html select menu should be hidden), but when I click an option I get several of these errors:

"this._optionList" is null or not an object - ui.selectmenu.js Line 400

Any ideas why this does not work in IE?

Lines 399-401 of ui.selectmenu.js

_selectedOptionLi: function() {
    return this._optionLis.eq(this._selectedIndex());
},

Lines 4615-4622 of jquery-1.4.1.js

name = name.replace(rdashAlpha, fcamelCase);

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

return style[ name ];

The jQuery UI Selectmenu plugin, demoed here: http://jquery-ui.googlecode./svn/branches/labs/selectmenu/index.html

I am having a couple of problems with this plugin. I'll focus on just one that only happens in IE.

I have html:

<label for="SearchState"></label>
<select style="width: 160px" name="SearchState" id="SearchState">
   <option>CT</option>
   <option>MA</option>
   <option>NH</option>
</select>

and jQuery:

$('select#SearchState').selectmenu();

In Firefox this works, however in IE I get error on load:

"Invalid argument" - jquery 1.4.2 Line: 4618

However the new styled selectmenu appears along with the original one (this is by design, but the original html select menu should be hidden), but when I click an option I get several of these errors:

"this._optionList" is null or not an object - ui.selectmenu.js Line 400

Any ideas why this does not work in IE?

Lines 399-401 of ui.selectmenu.js

_selectedOptionLi: function() {
    return this._optionLis.eq(this._selectedIndex());
},

Lines 4615-4622 of jquery-1.4.1.js

name = name.replace(rdashAlpha, fcamelCase);

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

return style[ name ];
Share Improve this question edited Jul 10, 2012 at 19:16 Jeffery To 11.9k1 gold badge29 silver badges42 bronze badges asked Jan 3, 2011 at 19:00 kralco626kralco626 8,66441 gold badges115 silver badges171 bronze badges 4
  • Is the plugin you are using the latest version? If not, try upgrading it and upgrading jquery if you can – Huangism Commented Jul 6, 2012 at 13:16
  • You need to be a bit clearer, you say you quoted an error from jquery 1.4.2 and then showed code from 1.4.1. Which version are you including in your page? Also which version of jQuery UI are you using? – Terry Commented Jul 6, 2012 at 13:43
  • Which version of jQuery, jQuery UI, selectmenu, IE, and Windows are you using? We just need some clarification. – Tyler Crompton Commented Jul 6, 2012 at 13:45
  • Does my answer answer your question? Just don't want you to forget about the bounty. – Tyler Crompton Commented Jul 10, 2012 at 17:59
Add a ment  | 

3 Answers 3

Reset to default 3 +50

I confirmed this behavior. I recreated it in this jsfiddle. After upgrading jQuery to 1.7.2, it did not give these errors. In this jsfiddle is the fixed version. Note that I also upgraded jQuery UI (because of jsFiddle) to jQuery UI 1.8.18, but the problems lie in the version of jQuery you are using. I remend updating to the most recent (stable) version of jQuery and jQuery UI, and selectmenu (JavaScript and CSS).

You are using an old jQuery UI labs plugin and it looks like it hasn't been worked on in a while.

Take a look at this fork on github https://github./fnagel/jquery-ui.

A fork of jQuery UI to push development of some plug-ins. Currently you will find: the latest version of Selectmenu (originally by filament group) and a accessible version of jQuery UI Tabs. Please check branch selectmenu and tabs-accessibility

If the demo you linked to works in IE, as a first step I would try using the same version of selectmenu that the demo is. If this works, you know it is a problem with the plugin.

本文标签: javascriptError usingjQuery UI Selectmenu plugin in IEStack Overflow