title: What is the best way to check which dropdown option is selected?
body: <p>Here is my HTML:</p>
  <pre><code>    &lt;select name=&quot;timezone-select&quot; id=&quot;timezoneSelect&quot;&gt;
        &lt;option id=&quot;LA&quot; selected value=&quot;America/Los_Angeles&quot;&gt;LA&lt;/option&gt;
        &lt;option id=&quot;NY&quot; value=&quot;America/New_York&quot;&gt;NY&lt;/option&gt;
        &lt;option id=&quot;LDN&quot; value=&quot;Europe/London&quot;&gt;LDN&lt;/option&gt;
      &lt;/select&gt;
  </code></pre>
  <p>And this is the JS I am currently using:</p>
  <pre><code>  var currentTz = document.getElementsByTagName('select')[0].value
    function switchTz(newTz) {
      currentTz = newTz
      refreshTime(currentTz)
    }
    document.getElementsByTagName('select')[0].addEventListener('change', switchTz(document.getElementsByTagName('select')[0].value))
  
    function refreshTime(TimeZone) {
      datetime = new Date()
      console.log(datetime);
      document.getElementById(&quot;dtime&quot;).textContent = datetime.toLocaleString('en-US', {
        timeZone: TimeZone
      });
      document.getElementById(&quot;timeLoc&quot;).innerHTML = currentTz
      console.log(currentTz)
    }
  </code></pre>
  <p>The console says that currentTz is undefined whenever I run the code. I want the value of whatever option  is selected in the dropdown box to be the new value of currentTz and I want it to run refreshTime(currentTz) anytime that an option is selected.</p>