Showing default text using placeholder property

When you show a form to user to enter values, it is important to tell user what the user needs to enter in a particular form field. HTML’s placeholder property comes handy for this purpose.

In the following code, the user is shown a search box, and by default the search box will show message to inform the user that he/she needs to enter some keywords

<form id="form1" name="form1" method="post" 
action="http://www.google.com">
<input id="txtsearch" name="txtsearch" type="search" placeholder="Enter Keyword" />
&nbsp;
<input id="btnsubmit" name="btnsubmit" type="submit" value="Search" />
</form>

Preview

Add a Comment

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