title: How to disable or enable html component through JS?
body: <pre><code>&lt;form&gt;
      &lt;input type="text" id="name" onkeydown="myHandler()"/&gt;
      &lt;select id="select"&gt;
          &lt;option value = "a"&gt;a&lt;/option&gt;
          &lt;option value = "b"&gt;b&lt;/option&gt;
      &lt;/select&gt;
  &lt;/form&gt;
  
  &lt;script&gt;
      function myHandler() {
          if(document.getElementById("name")){
              document.getElementById("select").disabled = true;
              return;
          }
          document.getElementById("select").disabled = false;
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>Well, this is all I have done. This disables the select whenever I input something in input but the select will stay disabled even if erase all the inputs in the input box. What can I do to make the select selectable if the input field is empty?</p>