The placeholder attribute is applied to an input field in order to display optional hint text that is visible when the field has no value. Entering a value into the field causes the placeholder text to disappear until the input value is removed.
Syntax:
<input type="text" name="query" placeholder="Enter a search query..." />
Elements:
Example
The placeholder attribute example:
x
<html>
<body>
<p>Enter a value:</p>
<form action="#" method="get">
<p>
<label for="query">Search:</label>
<input type="text" name="query" placeholder="Enter a search query..." />
</p>
<p>
<input type="submit" value="Search" />
</p>
</form>
<h5>p.s. submitting the form will not generate any action</h5>
</body>
</html>
Comments
No comments have been made yet.
Please login to leave a comment. Login now