J Query form validation disables whole JQuery Code.I made a simple validation form using J Query. It's not working. i have tried http://jsfiddle.net/4PuJL/165/ and working fine, but not working on my computer.
<!DOCTYPE html>
<html lang="en">
<head>
<script src="http://code.jquery.com/jquery-2.0.0.min.js"></script>
<script src="http://malsup.github.io/jquery.form.js"></script>
<script src="http://http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.1/jquery.validate.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#p1").mousedown(function () {
alert("Mouse down over p1!");
});
$("#personDetailForm").validate({
rules: {
persname: {
required: true,
regex: /^[A-Za-z]+$/
}
}
submitHandler: function() {
alert("alert");
}
});
});
</script>
</head>
<body>
<p id="p1">This is a paragraph.</p>
<form id="personDetailForm" action="showDetails.html" method="post" novalidate="novalidate" >
<p>
Name:
<input type="text" name="persname" id="persname" maxlength="50"></p><br>
Password:
<input type="password" name="perspswd" id="perspswd"><br>
<input type="reset" value="Reset">
<button type="submit">Submit</button>
</form>
<span></span>
</body>
</html>
if i remove below part,then first alert starts working
$("#personDetailForm").validate({
rules: {
persname: {
required: true,
regex: /^[A-Za-z]+$/
}
}
submitHandler: function() {
alert("alert");
}
});
,before thesubmitHandlerproperty, and therefore a syntax error. And a wrong url herehttp://http://ajax.aspnetcdn.com.