Skip to content

Instantly share code, notes, and snippets.

@mnpenner
Created December 5, 2014 18:12
Show Gist options
  • Save mnpenner/b4595fafcbee4f3a7c25 to your computer and use it in GitHub Desktop.
Save mnpenner/b4595fafcbee4f3a7c25 to your computer and use it in GitHub Desktop.
$.validator.setDefaults({
onfocusout: function(element, event) {
if(element.tagName === 'TEXTAREA' || (element.tagName === 'INPUT' && element.type !== 'password')) {
element.value = $.trim(element.value);
}
return $.validator.defaults.onfocusout.call(this, element, event);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment