I got a JavaScript code I wrote that calls a web service returns some data and populate the results in a combo box. However I ran into a problem where the ordering of items for the combo box is upside down in Google Chrome. In other browser such as IE and Opera it is in its order from the way the script populate the list of items.
I like to know is this a known issue with chrome itself or is it the way how chrome handles JavaScript.
Edit:
This is the function I call to add items to the combo box:
function addItemToDropList(comboBox, text, value) {
var dropListItem = document.createElement('option');
dropListItem.text = text;
dropListItem.value = value;
try
{
comboBox.options.add(dropListItem, null);
}
catch(e)
{
comboBox.options.add(dropListItem);
}
}
I’m assuming the
comboBoxvariable in your code snippet is the<select>element. If so, you should be able to use this: