How to put focus on an element in jQuery?
Posted
by Prashant
on Stack Overflow
See other posts from Stack Overflow
or by Prashant
Published on 2009-02-01T06:24:03Z
Indexed on
2010/03/13
21:55 UTC
Read the original article
Hit count: 229
Hi,
I have done the following code in JavaScript to put focus on the particular element (branch1 is a element),
document.location.href="#branch1";
But as I am also using jQuery in my web app, so I want to do the above code in jQuery. I have tried but don't know why its not working,
$("#branch1").focus();
The above jquery (focus()) code is not working for div, whereas If i am trying the same code with textbox, then its working,
Please tell me, how can I put focus on a div elemnt using jQuery?
Thanks!
© Stack Overflow or respective owner