OnChange Client Scripts are not triggered for each keystroke for HTML fields.
They are only triggered when the editor loses focus.
For standard text areas, there are easy workarounds you can implement.
But for HTML fields, things are a bit more complicated. The text is not stored as the value in a text area, but as HTML inside an iFrame.
This is not a bug, it’s a feature. It is working as designed by the TinyMCE team for performance reasons.
It is important to note that the onchange callback will not fire on each keystroke due to performance considerations. Executing the onchange callback all the time is just a bad design practice and it wastes the users CPU. It’s better to check the isDirty state before leaving the page in a document onbeforeunload event. This is how the autosave plugin functions. The isDirty approach is the recommended way of tracking if an editor instance has been modified or not.
You can try MutationObserver or setTimeout if you don’t care about causing performance issues and potentially