Limit number of characters in a textarea control that has the tinymce plugin

0

I have a textarea in a form, which has an editor so that the user can give different formats to the text. I do it with tinymce. Now, I need to control the amount of characters that you enter, so I do not want you to enter more than 200 (say a number).

<textarea id="detalle" name="detalle" rows="10" maxlength="2000"><?php if (isset($descripcion)) { echo $descripcion; }?></textarea>

the textarea I solve with a maxlenght but when I put the "link" to the tinymce plugin directly ignores it ... What can I do?

    
asked by MNibor 23.11.2017 в 23:41
source

1 answer

1

You always have the way to do it in javascript:

<script>

function limitarTextArea() {
       var texto = document.getElementById('detalle').value;
       if(texto.length < 2000) {
           return(true);
       }else{
           return(false);
       }
  }

</script>
    
answered by 24.11.2017 / 01:12
source