B2B Articles
May 18, 2011
By:Ironpaper

Clear form field with mouse click using simple Javascript (focus)

Making a user's experience enjoyable and hassle-free is a vital part of web design and development. In many website projects, you may need to have an HTML form with values pre-filled to describe the type of field the user is accessing.  This is one of the simplest ways to execute this approach. It uses a simple  event called onFocus to remove the text within "value".


<input type="text" name="myField" size=16 value="Click to remove text" onFocus="javascript:this.value=''" />
<input type="submit" />

Interested in working for or partnering with Ironpaper? We’d love to hear from you.
We are passionate about helping remarkable companies grow. We solve challenges that hold businesses back. We love it. 
Connect with Us