title: Disable item if input has value?
body: <p>I have 2 input. First input with <code>url</code> type. Second input with <code>file</code> type. I want to make disable first input when second has value. The same behavior when second input has value. I tried next code but it don't work correctly. Where is my mistake?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> $("#src").keyup(function(){
          if($('#src').val()){
              $("#src_url").toggleClass("disabled-field");
          }
      });
      $("#src_url").keyup(function(){
          if($('#src_url').val()){
              $("#src").toggleClass("disabled-field");
          }
      });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code> .disabled-field{
          pointer-events: none;
          opacity: 0.5;
      }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input name="src_url" class="form-control" id="src_url" type="url"&gt;
      
      &lt;input name="src" id="src" accept=".pdf, .zip, .rar, .doc, .docx, .rtf" type="file"&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>$("#src_url").on("input", function() {
      $("#src").prop("disabled", !!$('#src_url').val());
      $("#src").toggleClass("disabled-field", !!$('#src_url').val());
  });
  
  $("#src").on("change", function() {
    $("#src_url").prop("disabled", !!$('#src').val());
      $("#src_url").toggleClass("disabled-field", !!$('#src').val());
  });
  </code></pre>