이 코드는 tinymce 스크립트에서 사용할 수 있습니다.
및 "id_txt는"텍스트 영역 ID입니다
setup : function(ed) {
ed.onKeyUp.add(function(ed, e) {
txt = tinyMCE.activeEditor.getContent();
var strip = (tinyMCE.activeEditor.getContent()).replace(/(<([^>]+)>)/ig,””);
var text = strip.length + ” Characters”
tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + ‘_path_row’), text);
id_txt = tinyMCE.activeEditor.id;
//alert (id_txt);
//strip the html
txt = txt.replace(/(<([^>]+)>)/ig,””);
txt = txt.replace(/ /g,””);
if (id_txt == ‘blog_content’)
{
if (txt.length > 1000)
{
$(“#ErrorMsg”).css(‘display’,’block’);
$(“#ErrorMsg”).html(‘Please Enter Only 1000 Charecters !’);
txt = txt.substring(0,1000);
text = 1000 + ” Characters”;
tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + ‘_path_row’), text);
tinyMCE.activeEditor.setContent(txt);
ed.selection.select(ed.getBody(), true);
ed.selection.collapse(false);
return false;
}
}
/// Condition for Header Qutes
if (id_txt == ‘header_content’)
{
if (txt.length > 150)
{
$(“#ErrorMsg”).css(‘display’,’block’);
$(“#ErrorMsg”).html(‘Please Enter Only 150 Charecters !’);
txt = txt.substring(0,150);
text = 150 + ” Characters”;
tinymce.DOM.setHTML(tinymce.DOM.get(tinyMCE.activeEditor.id + ‘_path_row’), text);
tinyMCE.activeEditor.setContent(txt);
ed.selection.select(ed.getBody(), true);
ed.selection.collapse(false);
return false;
}
}
});
}!