Prevent users typing special characters in text box, textarea, etc.
$(document).on('keypress',':text,textarea', function () { if (this.value.match(/[^a-z0-9@,.'\-_) (]/gi)) { // now accept @ , - " this.value = this.value.replace(/[^a-z0-9@,.'\-_) (]/gi,''); } });
^[a-zA-Z]+$ | Alphabets |
^[a-zA-Z\s]+$ | Alphabets + Space |
Example:-
To collect a group of elements, we pass the selector to the jQuery function using…
jQuery is a lightweight, "write less, do more", JavaScript library. The purpose of jQuery is…
HTML:- [crayon-67ae7a35668cb236379384/] CSS:- [crayon-67ae7a35668d1549625720/] JavaScript:- [crayon-67ae7a35668d4684656375/]
Any interactive web site has form input - a place where the users input different…
[crayon-67ae7a3566c6a539603419/]