I have a Javascript function, which changes a text field of a form into
a select field. Following is the function
function changeStateField()
{
var myForm = document.getElementsByTagName("form")[0];
alert(myForm.stateId.value);
myForm.removeChild(myForm.stateId);
var stateSelect = document.createElement("select");
stateSelect.setAttribute("stateId2", "stateId");
myForm.insertBefore(stateSelect, myForm.countyId);
}
Function displays the correct value in alert. but on line 3
myForm.removeChild(myForm.stateId);
it gives following error. I am using Firefox.
Error: uncaught exception: [Exception... "Node was not found" code:
"8" nsresult: "0x80530008 (NS_ERROR_DOM_NOT_FOUND_ERR)" location:
"http://localhost:8080/APP/premiseCatalog.do Line: 245"]
Your help will be greately appreciated.
Regards,
Naeem.