I\'m using the excellent jquery.validation plugin by Jörn Zaefferer and I was wondering whether there\'s a easy way to automatically trim form elements before they are valid
I've found that the majority of these are not quite what is needed.
Using the following only fires on form change rather than on key down allowing you to still check on key stroke for the rest of the validation.
It's not as tidy as including it within the plugin, but it's an acceptable compromise.
$('body').on 'change', 'form input[type=text], form input[type=email]', ->
$(@).val $.trim($(@).val())