title: Text input does not change slider value on first attempt
body: <p>I am making a password generator with a text input and slider value that are tied together, however when I type in a value the first time it will not update. When I try again it works, as well as working subsequent times. The slider value always updates. I don't know what is wrong with the code to make it perform like this though, still fairly new to JS.</p>
  <p>//html</p>
  <pre><code>&lt;div class=&quot;slider&quot;&gt;
      &lt;input type=&quot;text&quot; id=&quot;slider-input&quot; value=&quot;&quot; onchange=&quot;setSlider(this)&quot;&gt;
      &lt;input type=&quot;range&quot; min=&quot;1&quot; max=&quot;64&quot; value=&quot;1&quot; id=&quot;slider&quot; oninput=&quot;myFunction(this)&quot;&gt;
  &lt;/div&gt;
  </code></pre>
  <p>//JS</p>
  <pre><code>const sliderInput = document.getElementById(&quot;slider-input&quot;);
  const slider = document.getElementById(&quot;slider&quot;);
  
  let passLength = &quot;&quot;;
  function myFunction() {
      slider.oninput = function() {
      sliderInput.value = this.value;
      passLength = this.value;
      }
  }
  
  function setSlider() {
      sliderInput.addEventListener(&quot;change&quot;, function() {
      slider.value = this.value; 
      passLength = this.value;
      })
  }
  </code></pre>