我有这个代码,我需要与Parsly.js一起工作 - 如何将这个代码插入到他们的结构中,以便向用户显示正确的消息。以下是组验证示例的链接 parsley group validation
<script>
$(document).ready(function(){
$("#some-form").validate({
rules: {
TextBox1: {
required: true,
number: true,
min: 0,
max: 100,
},
TextBox2 : {
required: true,
number: true,
min: 0,
max: 100,
}
TextBox3 : {
required: true,
number: true,
min: 0,
max: 100,
}
TextBox4 : {
required: true,
number: true,
min: 0,
max: 100,
}
},
submitHandler: function(form){
var total = parseInt($("#TextBox1").val()) + parseInt($("#TextBox2").val()) + parseInt($("#TextBox3").val()) + parseInt($("#TextBox4").val());
if (total != 100) {
$(".error").html("Your total must sum to 100.")
return false;
} else form.submit();
}
});
});
</script>