I've discovered an issue with chrome while trying to update the options of a select element when a user clicks on said select element. The system I'm working on basically works as per the JSFiddle below, except that the list of options are received via an ajax call, but even using an object produces the same result.
What appears to be happening is that when the user click and the options are displayed, it will only show 1 option. It will then populate the list of options but not update how many are displayed.
If you use the arrow keys to move up or down you can actually select the other options. The only way around it that I can find is to click off the select element and then click it again.
It works perfectly in IE and Firefox though.
A JSFiddle can be found here: http://jsfiddle.net/Largoh/Thz55/
HTML
<select id="selector">
<option value="2" selected>Option 2</option>
</select>
Javascript
$(function() {
$("#selector").click(function() {
if($("option", this).length < 2)
GetOptions(this);
});
});
function GetOptions(select) {
var Options = [
{ id: 1, text: "Option 1"},
{ id: 2, text: "Option 2"},
{ id: 3, text: "Option 3"},
{ id: 4, text: "Option 4"},
{ id: 5, text: "Option 5"},
{ id: 6, text: "Option 6"},
{ id: 7, text: "Option 7"}
];
$('option:first', select).remove();
for(var i = 0; i < Options.length;i++)
{
var option = $("<option/>");
option.val(Options[i].id).text(Options[i].text);
$(select).append(option);
}
}