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>