title: JavaScript: Hide button link if input field is empty
body: <p>I am trying to hide a button link (id="btnsubmit") whenever the input field (id="valagency") is empty, so that my user can only click on the button after the input field is filled with some data.</p>
  
  <p>For the html part, I have </p>
  
  <pre><code>&lt;tr&gt;
   &lt;td class="tbldatastart"&gt;
    &lt;input type="text" id="**valagency**" name="agencyname&lt;%= strAgencyId %&gt;" class="btn10" readonly&gt; 
    &lt;input type="text" name="agencyid&lt;%= strAgencyId% &gt;"&gt; 
    &lt;a href="javascript:Map('&lt;%= strAgencyId %&gt;');" class="btn1"&gt;Map&lt;/a&gt;
   &lt;/td&gt;
  &lt;/tr&gt;
  
  &lt;tr&gt;
   &lt;td colspan="2"&gt;&lt;/td&gt;
   &lt;td&gt;&lt;a href="javascript:Submit()" id="btnsubmit" class="btn1"&gt;Submit&lt;/a&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>And for the javascript, I have</p>
  
  <pre><code>function Submit() {
  
    $("#valagency").keyup(function(){
      if($(this).val()) {
          $("#btnsubmit").show();
      } else {
          $("#btnsubmit").hide();
      }
  
    });
  }
  </code></pre>
  
  <p>The submit button is still there. I do not know where I did wrongly. Please help.</p>
  
  <p>Thanks in advance.</p>