Adding focus to a form field means that when the page with the form loads, the field with focus will have the cursor flashing in the field ready for text input. Various research has shown that this increases conversion rates.
HTML5 includes the autofocus attribute that makes it simple to add focus to a field in many circumstances. Unfortunately the very popular Gravity Forms plugin for WordPress doesn’t make it easy to insert the HTML autofocus attribute. We can however very easily add focus using some simple jQuery.
To add focus to a form field follow these instructions:
- Find and make a note of the id of the field where you want focus.
- Add the following to wherever your theme allows you to add scripts
- Change the #input_2_2_3 in the script above to the id of the field you made a note of in step 1.
Your field will now be in focus when the form loads.