Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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