Display Short Hint for Expected Value in HTML



Use the placeholder attribute in HTML to display a hint describing the expected value of the element.

Example

You can try to run the following code to implement placeholder attribute −

<!DOCTYPE html>
<html>
   <body>
      <h2>Login</h2>
      <form action = "/new.php">
         <input type = "text" placeholder = "Student UserName" name = "name"/><br>
         <input type = "password" placeholder = "Password" name = "password"> <br><br>
         <input type = "submit" value = "Submit">
      </form>
   </body>
</html>
Updated on: 2020-05-31T00:27:36+05:30

281 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements