Delete default input value on click

lapkričio 18th, 2011

I hate this task: „Delete default value of an input text on click„. Many times i use code like this

<input type="text" value="" name="email"
onblur="if (this.value == '') {this.value = '';}"
onfocus="if (this.value == '') {this.value = '';}" />

Forget about this! I would recommend you try HTML5 solution below which uses the placeholder attribut.

<input name="Email" type="text" value="" placeholder="" />

Be Sociable, Share!

One Response to “Delete default input value on click”

  1. 1 Makendra
    gruodžio 1st, 2011 at 12:49

    A bit suriprsed it seems to simple and yet useful.

Leave a Reply