CKEditor MaxLength or CharCount

  • 1
  • Question
  • Updated 3 years ago
I've got a rich-text field where I want to limit the number of characters that a person can enter, or at least show the user how many characters they have typed so far.

I've successfully done this with a standard textarea using a javascript snippet but when I try it on the rich-text field it seems that I can't access the DOM object.

This works for a textarea: $('.Caption textarea').val().length

This does not work for the CKEditor for a rich-text field: $('.About .nx-richtext-input').html().length

Where I have defined custom classes Caption and About for the respective fields.

My sense is that my javascript snippet is running before the DOM object for the CKEditor is set up. I tried various ways but could not get access to that DOM object.

If anyone has an idea of how to access the CKEditor object via javascript please let me know.

Trying a different tack there are plugins for CKEditor that do this already. Here is one example:

Is there a way to tell what CKEditor plugins, if any, Skuid is providing?

Is there a way to add a CKEditor plugin dynamically?

Photo of Tony Sirna

Tony Sirna

  • 976 Points 500 badge 2x thumb

Posted 3 years ago

  • 1

Be the first to post a reply!