I know that there are a lot of other threads with this question, but I think I'm doing something gravely wrong because nothing seems to work.
I'm new at jQuery, so I'm still learning. Basically, my question is:
I want to make it so that when I click on an element on my website, it is essentially pressing the down arrow on the keyboard for the entire page.
So let's say I have a DOM object, a div with id "downarrow".
This is the jQuery code I have to make it happen, but it just doesn't work.
$("#downarrow").click(function(){
var e = jQuery.Event("keypress");
e.which = 40;
e.keyCode = 40;
$(document).trigger(e);
});
Any thoughts or suggestions why? Thanks in advance!