Reputation: 5661
How can I check if tinymce has empty content? I'm testing it:
Tinymce editor doesn't return me a empty string because it set by default a empty tag
<div> </div>
It put empty div row because I set forced_root_block option as 'div', but I don't want change forced_root_block.
I try with regex
editorContent.replace("/(<div> </div>)+/gi"," ");
editorContent = editorContent.replace(/^\s+|\s+$/g,"");
but It doesn' work. I wrong regex?
How can I do?
Upvotes: 4
Views: 3688
Reputation: 2140
Just add that to your test:
if (editorContent == '' || editorContent == null || editorContent == '<div> </div>')
It's not strictly speaking empty content, but it indicates the user hasn't made any meaningful changes to the textarea, which is I assume what you want to know.
Upvotes: 1