简体   繁体   English

如何使用Java脚本验证Bootstrap编辑器

[英]How to validate Bootstrap editor using java script

How to validate Bootstrap editor using java script. 如何使用Java脚本验证Bootstrap编辑器。 I have tried the below code but its not working. 我已经尝试了以下代码,但无法正常工作。

if ( $("#Editor-editor").html() == "" )
{
 alert("Should not empty");
}

If bootstrap editor is empty then then alert message should show. 如果引导编辑器为空,则应显示警报消息。

Editor=input ? 编辑器=输入? On validation you have to work with custom library. 验证时,您必须使用自定义库。 For instance 例如

  1. jquery validation http://jqueryvalidation.org/ jQuery验证http://jqueryvalidation.org/
    1. io validation http://formvalidation.io io验证http://formvalidation.io

These validations rendered different ways so first you need to choose one js library. 这些验证呈现了不同的方式,因此首先您需要选择一个js库。

After you included your library , checking empty elements is performed automatically, depending on attributes of element. 包含库之后,将根据元素的属性自动执行检查空元素的操作。 For instance: <input id="cname" name="name" minlength="2" type="text" required> means you need to fill this field with minlength=2. 例如: <input id="cname" name="name" minlength="2" type="text" required>表示您需要用minlength = 2填充此字段。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM