I want to print the user's input when he stops typing. My html code is:
<!DOCTYPE html>
<html>
<head>
  <link rel="stylesheet" href="jacoco.css">
  <script src="https://code.jquery.com/jquery-3.4.0.js" integrity="sha256-DYZMCC8HTC+QDr5QNaIcfR7VSPtcISykd+6eSmBW5qo=" crossorigin="anonymous"></script>
  <script src="jacoco.js"></script>
</head>
<body>
  <div class="search">
    <input type="text" id='jacoco' placeholder="Search for a title..">
  </div> 
  <div class="results"></div>
</body>
</html>
I am trying to do what is suggested in this post but it doesnt work. My js code is:
var typingTimer;                //timer identifier
var doneTypingInterval = 500;  //set wait time until search starts to 5 seconds
//on keyup, start the countdown
$('#jacoco').keyup(function(){
    clearTimeout(typingTimer);
    if ($('#jacoco').val()) {
        alert($("#jacoco").val());
        typingTimer = setTimeout(doneTyping, doneTypingInterval);
    }
});
//user is finished typing
function doneTyping () {
    alert('$("#jacoco").val();');
}
So when I am typing in the search box it doesn't print my input.
 
    