Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error using jQuery UI Selectmenu plugin in IE

The jQuery UI Selectmenu plugin, demoed here: http://jquery-ui.googlecode.com/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 ];
like image 972
kralco626 Avatar asked Jan 03 '11 19:01

kralco626


People also ask

What is selectmenu in jQuery?

Introduction to jQuery UI Selectmenu The jQuery UI selectmenu is used to extends and provides the customizable functionality in behavior and appearance of the native HTML select element. The jQuery UI selectmenu () function is a built-in function in the jQuery UI library.

Are there any issues with jQuery UI in older browsers?

While jQuery UI might run without major issues in older browser versions, we do not actively test jQuery UI in them and generally do not fix bugs that may appear in them. Similarly, jQuery UI does not fix bugs in pre-release versions of browsers, such as beta or dev releases.

What is this jQuery UI Widget?

This jQuery UI widget provides an accessible, styleable, and configurable replacement for select elements, allowing you to customize their behavior and appearance for a richer user experience. The plugin uses progressive enhancement to pull the content and state information from the select before replacing it in the page.

What should I do if I find a bug with jQuery?

If you find a bug with jQuery UI in a pre-release of a browser, you should report the bug to the browser vendor. jQuery UI supports several versions of jQuery Core. The version of jQuery being used may further limit which browsers jQuery UI will run in. See jQuery's browser support for a list of supported browsers by version.


Video Answer


1 Answers

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 recommend updating to the most recent (stable) version of jQuery and jQuery UI, and selectmenu (JavaScript and CSS).

like image 133
Tyler Crompton Avatar answered Oct 21 '22 05:10

Tyler Crompton