Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get form values to disappear when I enter the field?

I am making a simple form with about eight input fields. I want the initial value in the field to indicate what people are supposed to enter. For example value="name" so that people know to enter there name there.

My question though is how do you get the initial value to vanish when they enter that field so that the initial value is only a hint and not a permanent value that they have to erase before they can type in their name?

Thanks!

like image 395
forrest Avatar asked Oct 01 '09 17:10

forrest


People also ask

How do I clear the previous text field value after submitting the form with out refreshing the entire page?

The reset() method resets the values of all elements in a form (same as clicking the Reset button). Tip: Use the submit() method to submit the form.

How do you make text disappear in HTML?

You can also make an element so transparent that it's invisible using the opacity CSS property. Like visibility: hidden, opacity: 0.0 will leave an empty space where the HTML element is.

How do you hide a form field?

The <input type="hidden"> defines a hidden input field. A hidden field lets web developers include data that cannot be seen or modified by users when a form is submitted. A hidden field often stores what database record that needs to be updated when the form is submitted.


1 Answers

A much easier way could possibly be:

placeholder="Name"
like image 164
Matt Avatar answered Nov 01 '22 11:11

Matt