Don't allow typing alphabetic characters in a <input type=number />

前端 未结 9 773
情话喂你
情话喂你 2020-12-30 01:13

I need to have a textbox, where, whenever typed inside should ONLY allow numbers [0-9]. I\'ve used type=\"number\" which definitely holds the client side valida

9条回答
  •  無奈伤痛
    2020-12-30 02:09

    Browsers behave differently. In Chrome the following code:

    
      
    

    will work for you only if it is in a form and only after the user clicks the submit button.

提交回复
热议问题