Just wanted to ask a quick question. shown in the code below that I've done, I was wondering if you could tell me why on IE console that it says the function name is undefined.
JavaScript Code:
function check() {
var checked = null;
var inputs = document.getElementsByName('examGroup');
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].checked) {
checked = inputs[i];
break;
}
}
Thanks everyone, and hope you can help! ----EDIT----
Here is the IE console error with the line number: SCRIPT5009: 'check()' is undefined - File: Index.html, Line: 160, Column: 27
Here is where it is getting stuck at:
<input onClick="check()" type="radio" id="A1" name="examGroup" value="GCSE" />GCSE
It's because check()
is defined within the function validateForm()
and in such is not really defined by itself. Move it outside the function validateForm()
along with the rest of your functions.
function validateForm() {
...
};
function check() {
...
}