How to use placeholder attribute in HTML?

HTMLWeb DevelopmentFront End Technology

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.

Example

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

<!DOCTYPE html>
<html>
   <body>
      <h2>Register</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>
raja
Published on 24-Jan-2018 07:57:17
Advertisements