this is my code that i used in my validation js file
$(document).ready(function () {
$("form[name='signupform']").validate({
rules: {
firstname: "required",
lastname: "required",
email: {
required: true,
// Specify that email should be validated
// by the built-in "email" rule
email: true
},
password: {
required: true,
minlength: 5
}
},
// Specify validation error messages
messages: {
firstname: "Please enter your firstname",
lastname: "Please enter your lastname",
password: {
required: "Please provide a password",
minlength: "Your password must be at least 5 characters long"
},
email: "Please enter a valid email address"
},
});
$("#next").click(function () {
alert("Valid: " + $("#signupform").valid());
// $("input:blank").css("border", "1px solid red");
console.log("next is working");
});
});
this is the script files that i have used
<script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/jquery.validate.min.js"></script>
<script src="https://cdn.jsdelivr.net/jquery.validation/1.16.0/additional-methods.min.js"></script>
<script src="~/assets/js/validation.js"></script>
now my problem is that when i use form.valid method its give me error in my jquery.validation.min.js file that "can not used the property of form"
.valid()to anidbut the Validate method is attached to the name. Add theidto your form or use thenameinstead.