Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erezLieberman/80e7a52bab73ec350be9 to your computer and use it in GitHub Desktop.
Save erezLieberman/80e7a52bab73ec350be9 to your computer and use it in GitHub Desktop.
//disable the submit btn when input field empty
$('input.search-field').mousemove(function() {
var empty = false;
$('.search-field').each(function() {
if ($(this).val().length == 0) {
empty = true;
}
});
if (empty) {
$('.search-submit').attr('disabled', 'disabled');
console.log('cant submit');
} else {
$('.search-submit').removeAttr('disabled');
console.log('can submit');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment