我试图让jQuery验证插件与bootbox.js一起使用。
我想用bootbox显示一条消息而不是错误标签。 这是我的代码
$().ready(function() {
// validate the comment form when it is submitted
$("#mainform").validate({
debug: true ,
rules: {
idmail: {
required: true,
minlength: 7,
email: true
} ,
idnome: {
required: true,
minlength: 2
}
},
messages: {
idmail: "please insert a valid mail",
idnome: "please insert a name"
}
});
});

<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://cdn.jsdelivr.net/jquery.validation/1.15.0/jquery.validate.min.js"></script>
<meta charset="utf-8">
<title>Sets up validation for a form, then checks if the form is valid when clicking a button.</title>
<link rel="stylesheet" href="http://jqueryvalidation.org/files/demo/site-demos.css">
</head>
<form id="mainform">
Email : <input type="text" name="idmail" > <p>
Name : <input type="text" name="idnome" id="idnome">
<input type="submit" value ="Invia">
</form>
&#13;