javascript - SELECT box: On IE item is added to OptGroup instead of root. FF ok -
i've got behaviour bit strange select box , optgroup: use optgroup , try add @ end single item expect out of optgroup. ff expected ie adds optgroup
with code : fiddle (note: jquery use .ready method, can't use in 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 different in ie , ff
ie:
ff: 
note : i'm using javascript add item because i'm using gwt. way gwt adds item select.
this works in ie , chrome, should work in ff:
$(document).ready(function() { var select = document.getelementbyid("selectbox"); option = document.createelement( 'option' ); option.value = option.text = "test"; select.appendchild( option ); });
Comments
Post a Comment