i need key press or key down event for DIV, when the DIV has the focus? any ideas
+1
A:
give the div tag th tabindex property like
<div id="mydiv" tabindex="1" />
now you can do the trick, and bind the keydown - event
$('#mydiv').bind('keydown', function(event) {
//console.log(event.keyCode);
switch(event.keyCode){
....your actions for the keys .....
well, setting the focus on start, if you want to ... is like
$(function() {$('#mydiv').focus(); }
let me think, .. what else do you need to know...
css ... if you don't like the border, the div becomes on focus set the outline: none
a table of keycodes can be found here
for all of that .. assuming you're using jquery :-)
helle
2010-06-30 12:56:11
actually I am using jquery accordion effect when the user clicks on the div a calculator(I manually designed the calculator using html text field and buttons) shows below, i need the key press event for the calculator
Lalchand
2010-06-30 13:14:03
so what? i don't get it...
helle
2010-06-30 13:16:46