Here is my sample http://jsfiddle.net/RaQtg/4/ I want to redirect my page to another URL by pressing G key, But I couden't trigger click function.
any ideas?
thanks
.trigger()
like .click()
can only work if you defined an event handler using .bind()
(or .live()
or .on()
and all shortcuts available) methods.
try instead
$(document).on('keydown', function(e) {
if (e.keyCode === 103) //G key is pressed
{
alert("g key is pressed");
location.href = $('mylink').attr('href');
}
});