Number input. HTML

前端 未结 3 1581
悲哀的现实
悲哀的现实 2021-01-27 10:27

How can I create the number input in which user will be able to type only numbers which consist of five digits? I tried this but user still can type as many digits as he/she wan

3条回答
  •  生来不讨喜
    2021-01-27 10:51

    
    
    /* 
       Pattern
       0-9 = Only number.
       1,  = Minimum length,
       5  = Maximum Length
    */
    /*required="required" attribute also needed*/
    

    Best way if you use JavaScript form validation. Thanks.

提交回复
热议问题