Reputation: 3289
I need to fill a textbox with a value by default using the autofill function of jquery, this should disappear when the textbox is clicked. Any examples?
Upvotes: 1
Views: 585
Reputation: 5499
<input type="text" onclick="if(this.value!='') this.value = ''" onblur="if(this.value=='') this.value = 'Name:'" value="Name:" name="name" class="text">
Upvotes: 1
Reputation: 10219
You can use placeholder
from html5 if you want but, by default, it'll be shown only in last version of : safari, chrome and the ff4 beta.
You can emulate it with modernizr which works well (I tested it)
See the docs here .
Once loaded, you can use it like this :
<input type="text" name="foo" placeholder="Your name please" />
Upvotes: 1