title: Pass a group of IDs to function (onchange function)
body: <p>I have 10 html table lines. In each line I have 1 checkbox and 2 input boxes, each element with an unique ID (AA, Price_1, RTprice_1, AB, Price_2, RTprice_2....AJ, Price_10, RTprice_10)</p>
  <p>Trying to disable the corresponding input fields once a checkbox is checked. I'm repeating the function for each line. How can I pass each group of variable into the below function instead of having 10 functions? Script:</p>
  <pre><code>document.getElementById(&quot;AA&quot;).onchange = function() {
  document.getElementById('price_1').disabled = !this.checked;
  document.getElementById('RTprice_1').disabled = !this.checked;
  document.getElementById('price_1').value = &quot;0&quot;;
  document.getElementById('RTprice_1').value = &quot;0&quot;;
  document.getElementById('AA').value = &quot;0&quot;;
  };  
  
                                         
  document.getElementById(&quot;AB&quot;).onchange = function() {
  document.getElementById('price_2').disabled = !this.checked;
  document.getElementById('RTprice_2').disabled = !this.checked;
  document.getElementById('price_2').value = &quot;0&quot;;
  document.getElementById('RTprice_2').value = &quot;0&quot;;
  document.getElementById('AB').value = &quot;0&quot;;};
  </code></pre>