user550265
user550265

Reputation: 3289

Autofill for jquery

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

Answers (3)

Yoram de Langen
Yoram de Langen

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

Shikiryu
Shikiryu

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

SLaks
SLaks

Reputation: 887315

You're looking for a watermark plugin, such as this one.

Upvotes: 2

Related Questions