javascript - Why doesn't keydown event work on regular container div? -


i must losing it, can't keydown event work:

i tried:

$('#container').keydown(function() {             console.log("down");             alert('down');     }); 

also tried:

$('#container').on('keydown',function() {             console.log("down");             alert('down');     }) 

http://jsfiddle.net/foreyez/mwptttdv/

you can browser recognize keydown on div if give tabindex attribute:

<div id='container' tabindex="1"></div> 

jsfiddle example


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -