我正在使用jQuery Validation Plugin的简单表单 https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js (http://jqueryvalidation.org/documentation/)
当标签.error 类被调用时,它出现在输入字段下方。如何使其与正常的标签名称
一起显示链接: i.imgur.com/KchiGeF.jpg
<label>Your Name</label>
<input name="phone" id="phone" required type="text" size="40" >
JQuery功能
$(document).ready(function () {
$('#myform').validate({ // initialize the plugin
rules: {
phone: {
required: true,
minlength:10
}
}
});
});
答案 0 :(得分:0)
在声明规则之前,请更改errorElement。
errorElement: "span"
默认情况下,它是label
$(document).ready(function () {
$('#myform').validate({ // initialize the plugin
errorElement: "span",
rules: {
phone: {
required: true,
minlength:10
}
}
});
});