Note that there are some explanatory texts on larger screens.

plurals
  1. POTinyMCE text editor max char limit
    primarykey
    data
    text
    <p>I am using TinyMCE for <code>&lt;textarea&gt;</code>. My requirement is to limit the character size to 2000 and also to show the remaining characters somewhere below the tool bar. I somehow managed to get the characters number; now I am stuck with displaying the remaining characters and prevent from exceeding limit.</p> <p>Here is my TinyMCE code</p> <pre><code>tinyMCE.init({ // General options mode : "textareas", theme : "simple", plugins : "autolink,lists,pagebreak,style,table,save,advhr,advimage, advlink,emotions,media,noneditable,visualchars,nonbreaking, xhtmlxtras,template", // Theme options theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|, justifyleft,justifycenter,justifyright, justifyfull,|,styleselect,formatselect, fontselect,fontsizeselect", theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|, link,unlink,anchor,image,code,|,forecolor, backcolor", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : true, charLimit : 10, // this is a default value which can get modified later setup : function(ed) { //peform this action every time a key is pressed ed.onKeyUp.add(function(ed, e) { //define local variables var tinymax, tinylen, htmlcount; //manually setting our max character limit tinymax = ed.settings.charLimit; //grabbing the length of the curent editors content tinylen = ed.getContent().replace(/(&lt;([^&gt;]+)&gt;)/ig,"").length; //setting up the text string that will display in the path area htmlcount = "HTML Character Count: " + tinylen + "/" + tinymax; //if the user has exceeded the max turn the path bar red. if (tinylen&gt;tinymax){ } }); } }); </code></pre> <p>For testing purpose I am trying to limit up to 10 char.<br> Any suggestions are welcome.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload