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-663c3c1e6ed05255853438/] CSS:- [crayon-663c3c1e6ed0e320371249/] JavaScript:- [crayon-663c3c1e6ed12023185652/]
Any interactive web site has form input - a place where the users input different…
[crayon-663c3c1e6f283357959582/]