Created
March 28, 2016 03:42
-
-
Save siamkreative/d4e7abe544e18bd1fd9c to your computer and use it in GitHub Desktop.
Check if a TinyMCE editor is empty in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function ($) { | |
// Check if TinyMCE is active | |
if (typeof tinyMCE != "undefined") { | |
$('form').on('submit', function () { | |
// Get content of active editor | |
var editorContent = tinyMCE.activeEditor.getContent(); | |
if ((editorContent === '' || editorContent === null)) { | |
// Do stuff when TinyMCE is empty | |
} | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment