使用maxlength属性在HTML中添加最大值。您可以尝试运行以下代码以实现maxlength属性-
<!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>