Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
76
rated 0 times [  81] [ 5]  / answers: 1 / hits: 32374  / 11 Years ago, sat, november 2, 2013, 12:00:00

I want to make an a element to gain focus, then press Enter to open the link.


<a id='link'>test</a>


I use $("#link").focus(), but it doesn't work.


How can I do this?


More From » jquery

 Answers
20

http://jsfiddle.net/RLJ5r/1/



Works fine.



HTML:



<a href=http://google.com id=link>test</a>


jQuery:



$(#link).focus();

[#74549] Thursday, October 31, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sonja

Total Points: 541
Total Questions: 113
Total Answers: 114

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
;