drake035
drake035

Reputation: 2877

How to put default text in input fields while keeping JS form validation functionality

Some jQuery plugin checks whether my form fields (text input and select) have been filled out before I can submit the form. Now I want to add default values in the fields such as "please enter your name". But if I do that, the JS plugin will validate these fields whereas in fact the user didn't enter anything in them.

I want JS NOT to validate fields containing a default value. Is it possible?

Upvotes: 0

Views: 204

Answers (1)

William Buttlicker
William Buttlicker

Reputation: 6000

Use Placeholder in your fields

EX:

<input type="text" name="username" placeholder="please enter your name">

Upvotes: 3

Related Questions