javascriptwordpresstinymce-4wp-editor

How to detect changes in wp_editor?


How do I detect in JavaScript if the content of a wp_editor tinyMCE instance has changed in WordPress 4.2.2?

I've tried with tinyMCE.editors["content"].isDirty() but the result is always false.


Solution

  • if (tinyMCE.activeEditor.isDirty())
        alert("You must save your contents.");
    

    is working for me.

    More: activeEditor, isDirty