title: How to access previous input element using jQuery
body: <p>I'm trying to access an input element so I can disable an input button when another one is clicked. For some reason I'm unable to get it after trying a few dozen different methods.</p>
  
  <p>I'd like to disable the 'Checkout' button when the 'Absent' button is clicked.</p>
  
  <p>Here is the HTML and Javascript</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>$(document).on('click','.absent',function(e) {
  
     e.preventDefault();
  
     var t = $(this);
   
     //t.parent('td.checkout').prop('disabled', true);
      t.closest('.checkout').prop('disabled', true);
      
    });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;td&gt;
    &lt;input type="button" class="checkin" value="Check-in" id="checkin_datetime" name="checkin_datetime"&gt;
  &lt;/td&gt;
  &lt;td class="nowrap"&gt;
    &lt;input class="checkout" type="button" value="Check-out" id="checkout_datetime" name="checkout_datetime"&gt;
  &lt;/td&gt;
  &lt;td class="nowrap"&gt;
    &lt;input class="absent Y" type="button" value="Mark Absent" id="absent_flag" name="absent_flag"&gt;
  &lt;/td&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p><a href="https://jsfiddle.net/cary/pjatf31y/9/" rel="nofollow noreferrer">https://jsfiddle.net/cary/pjatf31y/9/</a></p>