You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
607 B
23 lines
607 B
let searchInput = document.getElementById('booksearch');
|
|
let timeout = null;
|
|
// Listen for keystroke events
|
|
searchInput.addEventListener('keyup', function (e) {
|
|
// Clear the timeout if it has already been set.
|
|
clearTimeout(timeout);
|
|
// Make a new timeout set to go off in 1000ms (1 second)
|
|
timeout = setTimeout(function () {
|
|
if (searchInput.value.length > 2) {
|
|
searchTags(searchInput.value);
|
|
} else {
|
|
clearSearchTags();
|
|
}
|
|
}, 1000);
|
|
});
|
|
|
|
function searchTags(searchInput) {
|
|
console.log(searchInput);
|
|
}
|
|
|
|
function clearSearchTags() {
|
|
console.log("stop search");
|
|
}
|
|
|