Sometimes, we want to make an HTML text box show a hint when empty.
In this article, we’ll look at how to make an HTML text box show a hint when empty.
How to make an HTML text box show a hint when empty?
To make an HTML text box show a hint when empty, we use the placeholder
attribute.
For instance, we write
<input name="email" placeholder="Email Address" />
to set the placeholder
attribute to the text that shows when there’s no input value.
Conclusion
To make an HTML text box show a hint when empty, we use the placeholder
attribute.