Login | Register   
RSS Feed
Download our iPhone app
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.

Tip of the Day
Language: Web Development
Expertise: Beginner
May 26, 1999



Application Security Testing: An Integral Part of DevOps

Make a Cursor Appear in First Form Field

When designing a form, like a login page, how do I make the cursor automatically sit in the first form field? For example, I ask for an admin number and a pin number. First, however, the user must click in the admin number input field box before they can type their response. I would like the default to be automatically in the input box.

You can use client-side script to control which field has focus. Use the window_onload event to run script that sets focus to the textbox that you want. The JavaScript in this page will do the trick:






DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date