How to set the focus to the first input element in an HTML form independent from the id?

Posted by splattne on Stack Overflow See other posts from Stack Overflow or by splattne
Published on 2008-11-10T10:30:31Z Indexed on 2010/04/30 13:37 UTC
Read the original article Hit count: 336

Filed under:
|
|
|

Is there a simple way to set the focus (input cursor) of a web page on the first input element (textbox, dropdownlist, ...) on loading the page without having to know the id of the element?

I would like to implement it as a common script for all my pages/forms of my web application.

Thanks!

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript