Set default text for text field in HTML form
In some websites, you might discover that some text fields already has text written it when the page loads. Text such as “enter your search here” or “input here”. You might wonder how to do it, is it to do with another programing language such as javascript?? The answer is no, HTML can do the do.
In HTML for text field, there is an attribute called “value” which defines the text would shows when the web page loads. Here is an example I created to show you how:
This is a text field without default text:
<input type="text" name="atextfield" />The text field:
Now we add the attribute “value” to it:
<input type="text" name="atextfield" value="default text here"/>The text field with pre-set text:






