I would like to create a validation for my password and confirm password. I currently have it so that if they don't match, it will come up with an alert for the user and tell them that they don't match, however even if they dont match it still continues and sends the form data to the desired location. How can I get it to validate and if they aren't the same, it will ask again and again until the condition is met?
Here is my code.
<script>
function checkpassword()
{
var p = Register.pass.value;
var cp = Register.cpass.value;
if(p == cp)
alert("Passwords match!")
else if (p != cp)
alert("Passwords do not match!")
}
</script>