Toggling Default Value of Textbox on Focus

When you click on the textbox, the dafault value disappears and when the focus loses, the default value appears in the text box.
<div><input type=”text” name=”firstname” id=”firstname” value=”eg. Siddharth Jain” onfocus=”if(this.value==’eg. Siddharth Jain’){this.value=”;}” onblur=”if(this.value==”){this.value=’eg. Siddharth Jain’;}” /></div>

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.