Given a form (please note the tabindex
property)
<form id="settings-form">
<input type="text" />
<input type="submit" />
<a href="#" class="cancel-save" tabindex="0">cancel</a>
</form>
Binding an action to the cancel button
$('#settings-form').find('.cancel-save').click(function(){ alert('CANCEL SAVE'); });
Now, when a user wants to cancel the changes, he will simply click the "cancel" button. But if he navigates with the TAB key and then hit enter the alert doesn't come up.
Is there a "master event" for this kind of actions, to handle both enter, clicks, spaces, etc., whatever accessibility features a user might have, without converting the <a>
into a <button>
?