How do I make jQuery click() event accessible?

I am using jquery’s click on a link to trigger an action. I am curious as to how to get it to work with a non-mouse user.

If the user hits the spacebar or enter key while the link is tab selected, the function is not activated.

I remember reading about using bind() but I can’t find the article.

use a hover with a timer lol

I just tried this with this very page. I added this JS:

document.getElementById('tabz').onclick = function(e) {
  e.preventDefault();
  alert('a');
}

‘tabz’ is the Home link in the navigation at the top.

Pressing “enter” when tabz is active produces the alert. I then tried this:

$('#tabz').click(function(e) {
  e.preventDefault();
  alert('b');
});

It works pressing enter. You must have made a mistake. Why don’t you post your code?

(spacebar just scrolls down the page BTW)

Ya, they probably should have named it action or activate instead of click.

Oh it does work with enter. Don’t know why I thought it was space. Thanks

Space works on some form elements.