31
rated 0 times
[
38]
[
7]
/ answers: 1 / hits: 16362
/ 12 Years ago, thu, february 21, 2013, 12:00:00
I tried to do an if/then statement in javascript but the then command is being ignored. Any ideas on why?
Specifically I want the form to be validated that the two text boxes are not blank and once that is validated I want a DIV ID = section2 to appear.
function checkanswers() {
var fdet = document.wastheform;
if (fdet.question_type[0].checked) {
var elements = new Array(name,address);
var elements_name = new Array(name, address);
for (var i = 0; i < elements.length; i++) {
if ($(# + elements[i]).val() == ) {
err = Please enter + elements_name[i] + ;
alert(err);
return false;
}
}
$(#section2).show();
}
More From » if-statement