I've got a behaviour a bit strange with Select
Box and OptGroup
:
I use OptGroup
and try to add at the end a single item which I expect to be out of the OptGroup
. FF does it as expected but IE adds it to the OptGroup
With this code : fiddle (Note: JQuery was just use for the .ready
method, I can't use it in my project)
<select id="selectbox">
<optgroup label="optGroup1">
<option>aaaa</option>
</optgroup>
</select>
$(document).ready(function() {
var select = document.getElementById("selectbox");
option = document.createElement( 'option' );
option.value = option.text = "test";
select.add( option );
});
The result is different in IE and FF
IE:
FF:
Note : I'm using Javascript to add the item because I'm currently using GWT. So this is the way GWT adds an item to a select
.