Question:
I have form where I'm using the Froala WYSIWYG Editor and I would like to validate if the editor is empty before submitting it. Is that possible?
Answer:
There is a built-in option called core.isEmpty that checks if the editor is empty. Based on the value returned by this method, you can prevent the form to submit and show an error there. Here is snippet for such a case:
$('form').on('submit', function (e) {
if ($('editor_selector').froalaEditor('core.isEmpty')) {
e.preventDefault();
// Display error message.
return false;
}
});