Wednesday, May 9, 2007

select option add

for the select tag on html.
instead of trying to appendChild.

select needs .add(element, reference)

example of code

selectTag=document.forms[0].selectTag
option1= document.createElement("option")
option1.text = "mama";
option1.setAttribute("value","mama");
selectTag.add(option1);

No comments: