VaR maxlength = 200; _ editor = ckeditor. replace ("ckeditor", {Height: '130px '}); _ editor. on ('key', function (event) {var oldhtml = _editor.doc ument. getbody (). gethtml (); var description = oldhtml. replace (/<. *?> /Ig, ""); var etop = $ ("# cke_shorttop"); VaR _ slen = maxlength-description.length; vaR canwrite = $ ("<label id = 'canonical'> You can also enter 200 words </label>"); If (etop. find ("# canwrite "). length <1){canwrite.css ({border: '1px # f1f1f1 solid', 'Line-height': '28px ', color:' #999 '}); etop. prepend (canwrite);} VaR _ label = etop. find ("# canwrite"); If (description. length> maxlength) {// alert ("You can enter up to" + maxlength + "text, you have reached the maximum number of words limit ");_editor.setdata(oldhtml#;_label.html (" You can also enter 0 ");}else{_label.html (" You can also enter "+ _ slen +" ");}});
Ckeditor word limit