Hi, I was wondering if there is a better way to capture a key press event on a div. At the moment, I have the following code
[code]
<div onkeypress=”var pressedKeyCode = window.event.keyCode; filter(document.getElementById(‘filterClass’), ‘classList’, 0, 0)”>
foobar
</div>
However that only works if I click on the div first. I have many of these divs lying around, they are created using javascript. I dont really want to go down the path of putting the code in the document on keypress, because its normally ends up with headaches using global event handers
Does anyone have any suggestions? Maybe involving the onmouseover() event handler for the div to set the focus to the div, and the onmouseout() to take the focus away again?
Thanks!