1
votes

I have implemented tiny mce html editor in my webpage. I works fine.But now i want detect white space exists in return value of the editor. I need to validate that.

Please help me to solve this issue.

Here the code i have tried on submit click for validation.

if (tinymce.activeEditor.getContent() == '') {
alert("Enter text");
}

This condition doesn't work if i enter only white spaces in my editor.

I need to validate the white spaces also.Please help me.

Thanks.

1

1 Answers

0
votes

The idea will be to trim the white spaces first. Please note tested

var cleanStr = $.trim(tinymce.activeEditor.getContent());
if (cleanStr == '') {
alert("Enter text");
}