Skip to content

Instantly share code, notes, and snippets.

@starzonmyarmz
Created September 24, 2012 15:29
Show Gist options
  • Save starzonmyarmz/3776534 to your computer and use it in GitHub Desktop.
Save starzonmyarmz/3776534 to your computer and use it in GitHub Desktop.
searchField.on('keyup paste', function() {
// Need a delay here because the paste event registers
// just before the text is actually pasted which would
// result in the input not having a value
var delay = window.setTimeout(function() {
if (searchField.val()) {
searchBtn.prop("disabled", false).removeClass("ui-state-disabled");
} else {
searchBtn.prop("disabled", true).addClass("ui-state-disabled");
}
window.clearTimeout(delay);
}, 25);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment