我有以下带有 TinyMCE 编辑器的 jQuery 验证脚本:http ://www.zinomen.com/test/validate.html
当字段为空时,根据名字和姓氏,您会收到错误消息,但在消息字段中您不会收到错误消息。
我使用以下代码:
<script type="text/javascript">
$.validator.setDefaults({
submitHandler: function() { alert('submitted, value of message = '+ tinyMCE.get('message').getContent()); }
});
$(document).ready(function() {
// validate signup form on keyup and submit
$("#signupForm").validate({
rules: {
firstname: {
required: true,
minlength: 2
},
lastname: {
required: true,
minlength: 2
},
message: {
required: true,
minlength: 15
}
},
messages: {
firstname: {
required: "Please fill in your firstname",
minlength: "Your firstname must consist of at least 2 characters"
},
lastname: {
required: "Please fill in your lastname",
minlength: "Your lastname must consist of at least 2 characters"
},
message: {
required: "Please fill in your message",
minlength: "Your message must consist of at least 15 characters"
}
}
});
});
</script>
您获得的 tinyMCE 字段的值:tinyMCE.get('message').getContent();
以及您拥有的形式<textarea id="message" name="message"></textarea>
任何人都可以帮助我,通过一个空的消息字段来获取 jquery 验证的错误吗?