Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function () {
- $('input').on('input', function () {
- var c = this.selectionStart,
- r = /[^a-z0-9@&%./() +-]/gi,
- v = $(this).val();
- if (r.test(v)) {
- $(this).val(v.replace(r, ''));
- c--;
- }
- this.setSelectionRange(c, c);
- });
- });
- $(document).ready(function () {
- $('input, textarea').on('input', function () {
- var c = this.selectionStart,
- r = /[^a-z0-9@&%./() +-]/gi,
- v = $(this).val();
- if (r.test(v)) {
- $(this).val(v.replace(r, ''));
- c--;
- }
- this.setSelectionRange(c, c);
- });
- });
Add Comment
Please, Sign In to add comment