title: Change attribute of element when another element is clicked, when there are multiple elements
body: <p>I'm trying to disable a textbox when a submit button is clicked - however there are multiple textboxes with submit buttons. The order of the textbox is the same as the order of the button (for example, the 1st button must disable the 1st button).</p>
  <p>As such, I've been using the following code:</p>
  <pre><code> window.onload = function() {
      document.querySelectorAll('button')[i].onclick = function fun(i) {
          document.querySelectorAll('input')[i].disabled = true
      }
  }
  </code></pre>
  <p>Where <code>i</code> would be the order of the button/textbox.</p>
  <p>Thanks in advance for your help.</p>