Firefox 中的 CKEDITOR jQuery 验证
我有 2 个 CKEditor 字段正在通过 jquery 验证输入。除了 Firefox 之外,一切都很完美。由于某种原因,它不会检查这些字段,除非 CKEDITOR 字段首先收到输入。因此,基本上,如果您进入页面并单击提交表单按钮,它不会检查这些字段,但如果您将光标放在字段内并尝试验证,它就会起作用。再说一遍,这只发生在 Firefox 中。
验证代码非常简单:
var edt1 = CKEDITOR.instances['div1'].getData();
if (!edt1) {
AppendErrorMessage("message.");
ShowValidationIcon($('#icon'));
}
return true;
这个问题有解决方法吗?
I have 2 CKEditor fields that are being validated for input by jquery. Everything works perfect except in Firefox. For some reason, it doesn't check for those fields unless the CKEDITOR fields received input first. So, basically, if you enter the page and click on submit form button, it won't check for those fields, but if you put cursor inside the fields and try to validate then, it works. again, that only happens in Firefox.
The validation code is very simple:
var edt1 = CKEDITOR.instances['div1'].getData();
if (!edt1) {
AppendErrorMessage("message.");
ShowValidationIcon($('#icon'));
}
return true;
Any workaround to this problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己找到了解决这个问题的方法。
这是因为 Firefox 会自动放置一些 HTML,因此该字段实际上并不是空的。这是解决所有浏览器问题的代码。
I found a solution to this problem myself.
It was due to the fact that Firefox was automatically placing a bit of HTML, so the field wasn't actually empty. Here's the code that solved the problem for all browsers.