diff --git a/static/js/index.js b/static/js/index.js new file mode 100644 index 0000000..5ab4c97 --- /dev/null +++ b/static/js/index.js @@ -0,0 +1,16 @@ +var typingTimer; +var finishedTypingInterval = 650; + +searchBar = document.querySelectorAll("form#search-bar input[type='text']")[0] +console.log(searchBar) + +searchBar.onkeyup = function(){ + clearTimeout(typingTimer); + if(searchBar.value){ + typingTimer = setTimeout(finishedTyping, doneTypingInterval); + } +}; + +function finishedTyping(){ + console.log("You stopped typing."); +}