Guest User

Untitled

a guest
Oct 19th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $(document).ready(function () {
  2. $('input').on('input', function () {
  3. var c = this.selectionStart,
  4. r = /[^a-z0-9@&%./() +-]/gi,
  5. v = $(this).val();
  6. if (r.test(v)) {
  7. $(this).val(v.replace(r, ''));
  8. c--;
  9. }
  10. this.setSelectionRange(c, c);
  11. });
  12. });
  13.  
  14. $(document).ready(function () {
  15. $('input, textarea').on('input', function () {
  16. var c = this.selectionStart,
  17. r = /[^a-z0-9@&%./() +-]/gi,
  18. v = $(this).val();
  19. if (r.test(v)) {
  20. $(this).val(v.replace(r, ''));
  21. c--;
  22. }
  23. this.setSelectionRange(c, c);
  24. });
  25. });
Add Comment
Please, Sign In to add comment