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 −


<!DOCTYPE html>

      <form action = "">

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

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

Published on 14-Mar-2018 08:28:53