How to get target element of keypress in designmode iframe

Posted by Tom on Stack Overflow See other posts from Stack Overflow or by Tom
Published on 2010-03-29T15:58:59Z Indexed on 2010/03/30 8:53 UTC
Read the original article Hit count: 529

Filed under:
|
|

Is it possible to get the target element in a keypress event handler in a design mode iframe ? I know it can be done in the mousedown event handler (by accessing event.target), but in the keypress / keydown handlers event.target is always the iframe element. For example, with the following html, if the user types into the div where it says * key press here *, I would like in the keypress / keydown event handler to be able to determine that the target element is the div with id='b'. Is this possible ?

<div id='a'>
    <div id='b'>
        *** Key press here ***
    </div>
</div>

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about dom