andreascarpello
9/24/2013 - 10:40 AM

Check input change and prevent submit with whitespace

Check input change and prevent submit with whitespace

  $('#textinput').bind('input', function(e){
		if( $(this).val().length > 0 && !/^\s+$/.test($(this).val()) ){
			$('#submit').removeClass( 'disabled' );
		} else {
			$('#submit').addClass( 'disabled' );
		}
	});