This is really bothering me. I just want the form to not submit if the function returns false. Here is the script.
function checkPass(){
var pass1 = document.getElementById('pass');
var pass2 = document.getElementById('pass2');
var message = document.getElementById('confirmMessage');
var goodColor = "#224466";
var badColor = "#900000";
if(pass1.value == pass2.value){
pass2.style.backgroundColor = goodColor;
return true;
}else{
pass2.style.backgroundColor = badColor;
return false;
}
}
The form still submits when I use:
<form onsumbit="checkPass();">
</form>
and when I use:
<form>
<input type="submit" onclick="checkPass();">
</form>
and no luck. Any ideas?