For an example, if I want the user to do both click and keypress that will give the same output. I would not like to have two of the same codes.
If I had something like
$('#next').click(function(){
// code goes here
});
I would like to also implement this
$(document).keydown(function(e){
if (e.keyCode == 37) {
alert( "left pressed" );
return false;
}
});
that will be part of the click. Any suggests? Thank you!!
You could also have myFunc() handle both events like so..