Posts Tagged ‘highlight text’

Highlight Contents of a Text Box On Click

Wednesday, March 12th, 2008

A project I was working on today for web design client in Los Angeles that involved a whole heck of a lot of form fields to run the admin backend of the website. I needed a quick and easy way to allow the client to change or delete everything in each field as quickly as possible. The best method is to highlight everything in the field using the onfocus() and select() javascript functions…

<input type="text" id="textfield" onfocus=”javascript: this.select();” />

Now isn’t that nice and simple? And the added usability is so great your clients will love you. You don’t have to tell them how little work it actually took ;)