Delete default input value on click

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

<input type="text" value="email@email.com" name="email"
onblur="if (this.value == '') {this.value = 'email@email.com';}"
onfocus="if (this.value == 'email@email.com') {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="email@email.com" />

Vienas atsakymas į “Delete default input value on click”

Parašykite komentarą

El. pašto adresas nebus skelbiamas. Būtini laukeliai pažymėti *