Archive for 'April 2008'
Dynamically populating ’select’ elements with javascript
new Option(text,value);
As referenced in many javascript sources including “The Book” is bad, and should not be used. new Option forces browsers to use an older DOM model (0 or 1) instead of the now modern level 2.
The DOM does not mix and match so doing:
selectBox.appendChild(new Option(text,value));
fails in IE.
The fix is to use the DOM1 level [...]


