restrict a character to type in a text box

前端 未结 5 638
借酒劲吻你
借酒劲吻你 2020-12-10 06:23

how we can restrict a character to type in a text box.

5条回答
  •  青春惊慌失措
    2020-12-10 06:44

    Ben Rowe's answer is indeed the way to approach it. However, the character will appear in the textbox before it is being removed. You can prevent that by using oninput instead of onkeyup:

    
    

提交回复
热议问题