detect what is being deleted

  •  01-29-2007, 8:22 AM

    detect what is being deleted

    Hi, is it possible to detect what is being deleted when the user presses delete or backspace?

    If I have my tag in the editor (<span id="myspan" contnetEditable="false">some text</span>), is it possible to detect what is being deleted?

    I can attach an onkeydown event and look for the keys to be pressed and if their is something selected in the editor I can get the selection and have a look at what is being deleted, (var r = selection.createRange(); r.htmlText) and see if it contains anything I'm interested in.....

    But if there is nothing selected is there any way of getting the location of the cursor and having a look at the getHtml() of the editor and see what is about to be deleted??

    Thanks in advance.
    Conall



View Complete Thread