Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
560
How to detect a change to the content of the HTML editor?
posted

I looked in the docs and couldn't find any information on any event signalling a change to the contents.

I then looked in the source and found the text area and tried hooking to the change event. This doesn't appear to fire.

How do I detect any change to the html editor?

Parents
  • 23953
    Offline posted

    Hi,

    There is "isDirty" method, but I don't think that this is what you're looking for. This method shows if the content is changed since the creation of the widget.

    One way to listen for a change is to bind to keypress event of the editor. Editor itself is rendered as IFRAME so you should bind to the IFRAME's document.

    Here is the sample code:

    Code Snippet
    1. $.ig.loader(function () {
    2.     var editorIdSelector = "#htmlEditor";
    3.     $(editorIdSelector).igHtmlEditor({
    4.         width: "100%"
    5.     });
    6.     var workspace = $(editorIdSelector + "_editor");
    7.     $(workspace[0].contentWindow.document).bind("keypress", function (e) {
    8.        // your code here
    9.     });
    10. });

     

    Best regards,

    Martin Pavlov

    Infragistics, Inc.

Reply Children