punymce icon indicating copy to clipboard operation
punymce copied to clipboard

Update innerHTML of source textarea on blur

Open jabbett opened this issue 13 years ago • 1 comments

I use jQuery to run a method whenever an input in my form changes, i.e.

$("textarea").live("change", function() { // do something });

I have PunyMCE enabled for a textarea, but the textarea's innerHTML never changes when I edit the text, so my change function never runs.

Does PunyMCE has its own way of defining a change event? Perhaps someone could provide a code snippet? Thanks!

jabbett avatar Jan 08 '12 01:01 jabbett

I looked through the source and found a few events that are dispatched by the editor. Seems to me that the onNodeChange event is what you are looking for.

  editor1.onNodeChange.add(function(){
    var content = editor1.getContent({save : true});
    console.log('new value :'+content);
  });

adg29 avatar Apr 13 '12 16:04 adg29