Skip to content

Instantly share code, notes, and snippets.

@evgv
Last active July 6, 2016 06:40
Show Gist options
  • Save evgv/42e6a9ae32daf44c3a1e101bf1b542bc to your computer and use it in GitHub Desktop.
Save evgv/42e6a9ae32daf44c3a1e101bf1b542bc to your computer and use it in GitHub Desktop.
jQuery. You can set any selector for field instead #email and you get realtime trim spacel from input, I'm use it for email fields.
  $(function(){
    $('#email').bind('input', function(){
      $(this).val(function(_, v){
       return v.replace(/\s+/g, '');
      });
    });
  });
  
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment