When working with input fields, is it possible to use actual text in the input fields instead of the transparent placeholder text.
With the contact form I am working on, I want to have pre-entered text, so the user just has to click submit.
CodePudding user response:
Use the value attribute <input type="text" value="default">
CodePudding user response:
Most of the time you can use the value
attribute.
For input fields you can use it like this:
<input type="text" name="fname" value="Peter">
For select
elements you can use it like this:
<select id=“laptops” name="laptops">
<option value="dell">Dell</option>
<option value="lenovo">Lenovo</option>
<option value="acer">Acer</option>
<option value="hp">HP</option>
</select>
For textarea
you cannot add a value attribute. The best way to add default value is to add it between the tags like this:
<textarea name="message" rows="5">
default value
</textarea>