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: ie result ff: ff result

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

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -