Created
September 24, 2013 10:40
-
-
Save andreascarpello/6683037 to your computer and use it in GitHub Desktop.
Check input change and prevent submit with whitespace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#textinput').bind('input', function(e){ | |
if( $(this).val().length > 0 && !/^\s+$/.test($(this).val()) ){ | |
$('#submit').removeClass( 'disabled' ); | |
} else { | |
$('#submit').addClass( 'disabled' ); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment