Hey guys, I'm creating a new field using the document.createElement, this is a new option for a select but cannot make the text to appears, I tried everything "but the correct syntax" i'm sure, can you help????
var parent = document.getElementById("box4");
var children = parent.all.tags("select");
var son = children[0];
var option = son.children.op1;
alert(option.value);
option.text = "text modified";
var txtFld = document.createElement("option");
//txtFld.setAttribute("type","new option");
txtFld.setAttribute("name","newOption");
txtFld.setAttribute("text","the new option text");
txtFld.setAttribute("id", "id2");
txtFld.setAttribute("value","thenewoptionvalue");
son.appendChild(txtFld);
var parent = document.getElementById("box4");
var children = parent.all.tags("select");
var son = children[0];
var option = son.children.op1;
alert(option.value);
option.text = "text modified";
var txtFld = document.createElement("option");
//txtFld.setAttribute("type","new option");
txtFld.setAttribute("name","newOption");
txtFld.setAttribute("text","the new option text");
txtFld.setAttribute("id", "id2");
txtFld.setAttribute("value","thenewoptionvalue");
son.appendChild(txtFld);

Comment