This version is old school.
Please find jQuery plugins on npm.
jQuery Allowed Chars - simple plugin
jQuery plugin to restrict users for typing only allowed chars for specified element
jQuery plugin to restrict users for typing only allowed chars for specified element