2
votes

I have some custom validation for my forms on my tinymce textarea. My problem lies there unfortunately. I'm limiting the text entered to 500 characters and below the box I have a 'counter' that counts down the characters they have until it's too long.

I have a keyup function working, but I'm having trouble grabbing the plain text from the text area.

I've already tried

tinyMCE.activeEditor.getContent()

and

tinymce.get('wChal').getContent()

but those grab everything including the html, and it's really not fair for the user if it's also counting the invisible html.

Anyone know of a solution?

1

1 Answers

2
votes

For future readers, I ended up doing something like this.

var con = tinyMCE.activeEditor.getContent();
var len = con.replace(/(<([^>]+)>)/ig,"").length;