Kolodvor

ruby, rails, javascript, jquery, …

Main menu

Skip to primary content
Skip to secondary content
  • Home
  • About me

Monthly Archives: January 2008

Set focus on first field with jQuery

Posted on January 17, 2008 by vlado
14

f you are using Prototype see this post.

Setting focus on the first text field with jQuery is as simple as

  $("input:text:first").focus();
  $("input:text:visible:first").focus();

Find more at http://docs.jquery.com/Selectors

Update: If you are on Rails you can use auto_focusable_forms, dependency free plugin that will focus first input for you.

Posted in jQuery | Tagged focus, form, jQuery, selectors | 14 Replies

Archives

  • March 2011
  • August 2010
  • July 2010
  • June 2010
  • February 2010
  • January 2010
  • September 2009
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • August 2007
  • July 2007

Meta

  • Log in
Proudly powered by WordPress