How to use placeholder attribute in HTML?

If you want to set a hint for text area or input field, then use the HTML placeholder attribute. The hint is the expected value, which gets displayed before the user enters a value, for example, name, details, etc.


You can try to run the following code to learn how to use placeholder attribute in HTML.

<!DOCTYPE html>
      <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">