title: Creating a timer with user input with html and js
body: <p>I am trying to create a simple timer, like the basic google one. I got it working until I tried to make it countdown from a value inputted by the user. I don't know why the code is no longer running. This is what I have so far:</p>
  
  <pre><code>&lt;!DOCTYPE HTML&gt;
  &lt;html&gt;
    &lt;body&gt;
      &lt;input id="userInput" type="number" defaultValue = "00"/&gt; 
      &lt;p id="timerr"&gt; 00 &lt;/p&gt;
      &lt;button onclick="startTime()"&gt;Start time&lt;/button&gt;
      &lt;button onclick="stop()"&gt;Stop time&lt;/button&gt;
  
      &lt;script&gt; 
        var myVar = setInterval(start, 1000);
        var timer = document.getElementbyId("userInput").value;
  
        function startTime(){ 
  
          document.getElementById("timerr").innerHTML = timer.value;
          myVar;
        } 
  
        function start(){
          document.getElementById("timerr").innerHTML = timer.value;
          timer.value--;
          if (timer == -1){
            stop();
            document.getElementById("timerr").innerHTML = "0";  
          }
        }
  
        function stop(){
          clearInterval(myVar);
        }
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am planning on making it better by making it countdown from minutes and hours, but I am just trying to get the seconds to function first. Thank you in advance.</p>