Loading…

Get Schooled at New Horizons

Info and insights from New Horizons Computer Learning Centers. 22 locations to serve you.
Start exploring

Auto-focus on the search input field to improve UI (HTML5)

More than half of all web users navigate using the search box, so from a user’s perspective that handy rectangle is one of the most important elements of a website. When a website visitor lands on the homepage, usually they will scroll down, then navigate to another page—often via the search box. A simple adjustment to your HTML will autofocus a user’s cursor into the input box as soon as the page loads so they are ready to go. Users that frequently visit the same website, such as those for banks or hospitals, benefit even more from this function as they grow to expect it and can begin typing their destination into the search box immediately after the page loads.

To add this auto-focus function to your search box, wrap your search function in the html code with: <input autofocus /></input>.

Share

Leave a Reply