完美!谢谢!
我正在使用编辑器 (ckeditor)。通过在 $("#form1").validate 中进行的此添加,我现在可以隐藏生成的错误消息,如果将在编辑器中输入某些内容。
这里是我的代码的相关部分......某人的 HTH......
在键位上更新TextArea1
CKEDITOR.instances.editor1.on("instanceReady", function()
{
//set keyup event
this.document.on("keyup", updateTextArea1);
//and paste event
this.document.on("paste", updateTextArea1);
});
获取editor1的数据,更新编辑器并隐藏错误信息
function updateTextArea1()
{
CKEDITOR.tools.setTimeout( function()
{
var oEditor1 = CKEDITOR.instances.editor1;
var content1 = oEditor1.getData();
CKEDITOR.instances.editor1.updateElement();
$(".error.errorextra1").hide()
}, 0);
}
将附加类添加到生成的 jquery 验证器错误消息中
var validator = $("#form1").validate({
showErrors: function(errorMap, errorList) {
this.defaultShowErrors();
$(this.currentForm).find('label[for=editor1].error').addClass('errorextra1');
$(this.currentForm).find('label[for=editor2].error').addClass('errorextra2');
},