How do we add the maximum number of characters allowed in an element in HTML?

HTMLWeb DevelopmentFront End Technology

Use the maxlength attribute to add the maximum value in HTML. You can try to run the following code to implement maxlength attribute −

Example

<!DOCTYPE html>
<html>
   <body>

      <form action = "">

         Rank:
         <input type = "number" name = "rank" min = "1" max = "10"><br>
         Cricketer:
         <input type = "text" name = "cricketer" maxlength = "20"><br>

         <input type = "submit" value = ”Submit”>
      </form>

   </body>
</html>
raja
Published on 14-Mar-2018 08:28:53
Advertisements