The code below works fine in Chrome but does not work in Firefox. The error displayed in the Firefox console is "Error: document.forms.frmCreateNewEmployee.elements is not a function".
document.forms['frmCreateNewEmployee'].elements('employeeType').value = document.getElementById("userType").options[document.getElementById("userType").selectedIndex].value;
How can I resolve this error?
The code below works fine in Chrome but does not work in Firefox. The error displayed in the Firefox console is "Error: document.forms.frmCreateNewEmployee.elements is not a function".
document.forms['frmCreateNewEmployee'].elements('employeeType').value = document.getElementById("userType").options[document.getElementById("userType").selectedIndex].value;
How can I resolve this error?
Share Improve this question edited Nov 7, 2011 at 18:21 KatieK 13.9k19 gold badges78 silver badges91 bronze badges asked Jul 23, 2011 at 7:28 RamanRaman 2,0113 gold badges20 silver badges30 bronze badges1 Answer
Reset to default 6Change .elements('employeeType')
to .elements['employeeType']
to fix the error.