only allow English characters and numbers for text input

前端 未结 7 759
旧巷少年郎
旧巷少年郎 2020-12-05 03:42

Live Demo: http://jsfiddle.net/thisizmonster/DveuB/

How can I change this so that the input only allows the characters A-Z, a-z, 0-9 while typing, without using a re

7条回答
  •  没有蜡笔的小新
    2020-12-05 03:56

    Think you have to write some if statements or something like that, that takes the keycode and validates it against some numbers that represent other keycodes:

    for example: if(keycode < 80) return false;

提交回复
热议问题