1 Stupidly Simple Way to Make Users VERY Happy

If you’re like me, you like to try to use your keyboard as much as possible.. or use your mouse as little as possible.

So when you go to log into a website and the username field doesn’t automatically have the cursor in it when the page loads, you get a little frustrated.

Oh, that only happens to me?

No but seriously, shouldn’t all websites automatically put your cursor in the form field which you most likely want to fill out?!

Go to http://www.gmail.com – if you were logged in already, log out and then go to there.

Did you notice how the username box is automatically highlighted, the cursor is already in there, and you’re ready to type? Did you like that?

If you’re like me, you LOVED it! (I’m weird, have you got that by now?)

This is something that is super simple to do, and should definitely be done if you:

Have a login screen – if someone is coming to your site to log in, they would really appreciate the username filed being auto-focused.

Have a popular online tool that people use – Do a Google search for “Character Count” – The number 1 and 2 results should be javascriptkit.com and lettercount.com… LetterCount.com auto-focuses the textarea field, whereas javascriptkit.com does NOT… therefore, I will link to and use lettercount.com for my character count needs.

Want someone to fill out your form – think about it… user comes to your site and lands on a page that has a lead capture form. If they see the first box of that form is already highlighted and has the cursor in there, ready to be typed into, they are more likely to fill it out! Make sure you know the secrets to turning leads into sales, otherwise: don’t waste your money on any form of marketing, OK?

How to Automatically Place Cursor In Text Field

It’s really easy if you:

If you understand HTML & javascript relatively well

Have access to the source code of your site.

If you aren’t comfortable with HTML or javascript – OR – don’t know how to access the source code of your website… get in touch with us, we will figure it out (call 888-WEB-NUM1).

All you have to do is add this javascript to the page(s) you want the form field to automatically focus on:

Note: With this method, you MUST put the javascript line BELOW the form in the HTML. Otherwise, it will try to execute and won’t find the form (because it hasn’t rendered yet). There is an alternative method below.

Let’s do a quick breakdown of the pieces at work here, but first, make sure you know what an HTML element id is.

In the first example I noted that you have to put that javascript below your form so the focus(); function would be able to find the form elements (load order)… but with this example, the code would obviously be above the form HTML… but since it runs AFTER all the HTMl on the page is loaded, it will surely find the input or text field you want to automatically put cursor in.

Yet Another Method to Automatically Putting Cursor In Text Field On Page Load

What? Another method… yeah, that’s right — And this one works in ALL BROWSERS! (correct me if I’m wrong)