Tag Archives: mootools

Add an <option> to a <select> using Mootools

var newoption = new Option(“option html”, “option value”); try { $(‘myselect’).add(newoption, null); } catch (err) { $(‘myselect’).add(newoption); } To select the newly created option: newoption.setProperty(‘selected’, ‘selected’);

Posted in Programming | Tagged , | Leave a comment