detect how a button was pressed in javascript -



detect how a button was pressed in javascript -

is there way observe how button pressed?

mouse clicked //mouse event highlighted via tab come in key //keypress event touched (mobile phones) //touch event

is there short javascript way observe this? or need add together event listeners click, enter, , touch? want info form submits. thanks

this how can handle

highlighted via tab come in key //keypress event

$('a').click(function(e) { console.log(e); // screen positions returns 0 on come in if( e.screenx == 0 && e.screeny == 0 ) { alert('enter'); } else if( e.type == "click" ) { alert('click'); } });

demo ofcause rest observe easily.

javascript

Comments

Popular posts from this blog

python - How to add an model instance to a django queryset? -

Using Android Volley to post an array to PHP -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -