Skip to content Skip to sidebar Skip to footer

Move Focus To A Particular Field

I have a button that will add show a form on the page. how can I move the focus to the first field of the form when that button is clicked? simple example: HTML:
Copy

Solution 2:

A quicker lookup would simply be.

$('#firstField').focus()

However if you removed the ID from your element then this would be better but slightly slower.

$('#newForm input:first').focus();

Solution 3:

Try this:

$('input#firstfield').focus();

Post a Comment for "Move Focus To A Particular Field"