How to clear an input when clicked?

Asked

Viewed 201 times

0

I have a form and I want it to appear in the field when loading the page "Insert your name here" and when the user clicks to type, I want that sentence to go away! Is it possible ? How is it done?

  • 3

    Read about the attribute placeholder of HTML.

1 answer

4


I believe the easiest way to do that would be to use the attribute placeholder of html:

Name <input type="text" name="name" placeholder="insert your name here"><br>

When the user starts typing, the message in question disappears from within the field.

  • 1

    Thank you very much! I had done so onfocus=" this.value= ' ' " but in its way it got even better!

  • Then he only accepts the answer so the community knows that his question has been answered. For this just click on the correct sign, similar to a "V" existing next to the answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.