Saturday, 17 August 2013

Jquery: prevent link from opening when pressing the ENTER key

Jquery: prevent link from opening when pressing the ENTER key

I have a list, in which each element contains a link.
By default, when the list element has "focus" and the I hit the ENTER key,
the browser automatically
redirects to the link.
Is there a way to prevent this behavior??
(So simply, I guess my question is how to prevent a link from opening when
the user hits ENTER..
HOWEVER, I still want to keep the link opening behavior on mouse CLICK
event!!
Thanks!!
<ul>
<li> <a href="SOMELINK1">LINK1</a> </li>
<li> <a href="SOMELINK2">LINK2</a> </li>
<ul>

No comments:

Post a Comment