I have a form that requires the user to enter their email address twice to ensure they enter it correctly. jQuery 1.9.0 has caused the below code to stop working, can someone please help with the update?
<script type="text/javascript">
jQuery(function(){
$("#submit").click(function(){
$(".error").hide();
var hasError = false;
var emailadrVal = $("#emailadr").val();
var checkVal = $("#emailadr-check").val();
if(! emailadrVal.match(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z.]{2,5}$/g) ){
alert('Please enter a valid email address.');
hasError = true;
}
if (emailadrVal != checkVal ) {
//$('#emailadr-error').html("Email addresses do not match.");
alert("Email addresses do not match. Please change.");
hasError = true;
}
if(hasError == true) {return false;}
});
});
$(document).ready(function(){
$('#emailadr-check').bind("cut copy paste",function(e) {
e.preventDefault();
});
});
</script>
The above code works fine with 1.3.2.
THANKS!!