Posted By

brentg on 06/13/08


Tagged

jquery


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

korzhik
benrudolph
esquareda


jquery - focus on the first text input field on the page


 / Published in: JavaScript
 

  1. // focus on the first text input field on the page
  2. $("input[type='text']:first", document.forms[0]).focus();

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: koncept on June 15, 2008

You can use :input as well — basically the same thing. $(function(){$(":input[@type='text']:first").focus()})

You need to login to post a comment.