jQWidgets Forums
jQuery UI Widgets › Forums › Lists › DropDownList › Issue in IE
Tagged: DropDownList
This topic contains 4 replies, has 2 voices, and was last updated by binfch 12 years, 1 month ago.
-
AuthorIssue in IE Posts
-
Hi there
I am using 2.6.1 (Unfortunately I cannot update to a more recent release just right now).
I create a dropdown list and load/add dynamically items. After that I make sure that the first item is selected using:
…
selectedIndex: 0
…Now at some point later I need to know the content of the selected item. So I do:
…
item = $(‘#aQueryMode’).jqxDropDownList(‘getSelectedItem’).label;
alert(item);
…This works fine in Chrome and FF. But not in IE (testing with v10). What can I do?
Thanks & cheers,
PeterHi Peter,
Please, send us a more complete sample which demonstrates your issue. The “getSelectedItem” method is a simple method which returns the selected item and it does not really depend on the browser so according to me, there is no selected item at the point the method is called.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hello Peter
Here’s an example that works fine on FF & Chrome but not in IE:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <link rel="stylesheet" href="./jqx.base.css" type="text/css" /> <script type="text/javascript" src="./jquery-1.8.3.min.js"></script> <script type="text/javascript" src="./jqx-all.js"></script></head><body> <script type="text/javascript"> $(document).ready(function () { var listArray = []; listArray.push('item1'); listArray.push('item2'); listArray.push('item3'); $("#jqxWidget").jqxDropDownList({ width: 270, height: 25, autoDropDownHeight: true, theme: 'classic', source: listArray, autoOpen: false, selectedIndex: 0, selectionRenderer: function (htmlElement) { var htmlString = htmlElement[0].innerHTML; return '<div style="position: relative; margin-left: 3px; margin-top: 2px;">' + htmlString + '</div>'; } }); item = $('#jqxWidget').jqxDropDownList('getSelectedItem').label; alert(item); }); </script> <div id='jqxWidget'></div></body></html>
Thx & cheers,
PeterHi,
No problem on my side with the current version. Btw, it is better to use:
var item = $(‘#jqxWidget’).jqxDropDownList(‘getSelectedItem’).label;
instead of
item = $(‘#jqxWidget’).jqxDropDownList(‘getSelectedItem’).label;
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Ooops, works indeed
Thx & cheers,
P. -
AuthorPosts
You must be logged in to reply to this topic.