title: Using jquery to disable a field if another field has a value (dynamically)
body: <p>I want to disable input2 if the user starts typing a value into input1.</p>
  
  <p>If there is no value in input1 (for example if the value is deleted), I also want input2 to be re-enabled.</p>
  
  <p>Here's what I wrote so far, but it's not working. </p>
  
  <pre><code>&lt;input id="input1" type="text"&gt;
  &lt;input id="input2" type="text"&gt;
  
  &lt;script&gt;
              $( document ).ready(function() {
              if($('#input1').val())
              {
                  $('#input2').prop('disabled', true);
              }
          });
  &lt;/script&gt;
  </code></pre>