Hello everyone!
I am using a jQuery plugin for validation of the input boxes, which will shake the boxes if they're left empty when trying to submit them.
Can somebody help me with that? I am using the following code, but it's not working. Please post me the solution or the sample application if you guys know any.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="scripts/jquery.validate.min.js" type="text/javascript"></script>
<script type="text/javascript">
$().ready(function () {
$('#contactform').validate({
rules: {
name: "required",
tel: "required",
province: "required",
email: { required: true
}
},
messages: {
name: "Please enter your Name",
tel: "Please enter your Surname",
province: "Mobile number is Required",
email: {
required: "Please enter email",
email: "Please enter a valid email address"
}
},
highlight: function (element, errorClass, validClass) {
$(element).stop()
.animate({ left: "-10px" }, 100).animate({ left: "10px" }, 100)
.animate({ left: "-10px" }, 100).animate({ left: "10px" }, 100)
.animate({ left: "0px" }, 100)
.addClass(errorClass)
.removeClass(validClass);
},
unhighlight: function (element, errorClass, validClass) {
$(element).stop()
.addClass(validClass)
.removeClass(errorClass);
},
errorPlacement: function (error, element) { }
});
});
</script>
Thank you