jQuery: Input Focus and Select

February 1st, 2010 by jeremychone

This will focus and select the text of a given input. Nice to help the user doing the most likely action.

$("input[name='First Name']").focus().select();

or using the “HTML5″ autofocus

<input type="text" autofocus="autofocus" />

Leave a Reply