Select Manipulation

Press each of the buttons below to see if your browser supports that method of adding a option to the select.

Browsers known to like all methods

Browsers with Trouble


The button that is green works in all the browsers above (except IEMac...but it's time to let that browser die). To sum up:

  1. Create the option with var opt = document.createElement('option')
  2. Append the option to the select using mySelect.appendChild(opt)
  3. THEN set the text and value for the option: opt.text="Hello"; opt.value=12;

If you MUST support IEMac, then go old-school nasty DOM 0, using new Option().