Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery validator to allow only basic characters

Tags:

jquery

I want to allow basic characters A-Z, a-z,0-9, and basic special characters ~``!@#$%^&*()_+-=[]{};'\:"|,./<>? availalbe on a standard english keyboard to be only typed in a text area.
Looking for help !

like image 963
Sourav Avatar asked Jan 20 '23 19:01

Sourav


1 Answers

Sample:

    $('#text_area_id').keyup(function() {
        $(this).val($(this).val().replace(/[^A-Za-z0-9~`!@#$%^&*()_+-=\[\]{};'\\:"|,.\/<>?]/g,''))
    });
like image 188
user748472 Avatar answered Feb 11 '23 03:02

user748472