How to make an HTML text box show a hint when empty?

Spread the love

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.

Leave a Reply

Your email address will not be published. Required fields are marked *