and*_*ick 3 javascript jquery keypress
我无法得到一个简单的答案:当我按下字母J时,我希望它隐藏$('.something'),当我按下字母H时,我希望它显示$('.something')
press the letter J
$('.something').hide()
press the letter H
$('.something').show()
Run Code Online (Sandbox Code Playgroud)
$(document).bind('keydown', function(e) {
if (e.keyCode == 72) {
// press the letter H
$('.something').show()
} else if (e.keyCode == 74) {
//press the letter J
$('.something').hide()
}
return false;
});?
Run Code Online (Sandbox Code Playgroud)