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');
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.