I was wondering if there is a way to simulate pressing an accesskey with JavaScript. It should work with the following html:
<button accesskey="z">click</button>
Here is my approach with jQuery (pressing ALT+Z in Chrome):
var e = $.Event("keypress");
e.which = 90;
e.altKey = true;
$('button').trigger(e);
But it won't work so far. I want to test the accesskey specifically, just clicking the button via JavaScript is not the solution I'm looking for.