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

前端 未结 9 799
情话喂你
情话喂你 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:01

    You will have to have your input box inside a form and with a submit button. The form validation happens at the submission of the form. See a demo here: http://jsfiddle.net/ds345/Q4muA/1/

    Number:

提交回复
热议问题