On a webpage, a <div> with class="button" has a click event. Because a keyboard user cannot activate the click event, this is not accessible. Typically, a keyboard user needs tab to an interactive element such as a link or button and press the space or enter key to activate. Only using JS/JQuery, how would you make this keyboard accessible?
Sigiloso
$('div.button').click(function() { alert('Here are 1000 Bitcoins!'); } ); $('.button').keypress(function(e){ if(e.which == 13 || e.which == 32){ //Enter key or space pressed $('div.button').click();//Trigger button click event } });