title: Call function .oninput
body: <p><a href="http://jsfiddle.net/Nightglow2006/wcfrLvzq/2/" rel="nofollow">JSFIDDLE</a></p>
  
  <p>HTML:
  </p>
  
  <pre><code>&lt;input type="number" id="strScore" class="attribScore" min=8 max=15&gt;
  &lt;input type="number" id="strMod" class="attribMod" readonly="readonly"&gt;
  </code></pre>
  
  <p>Javascript:</p>
  
  <pre class="lang-js prettyprint-override"><code>/****************************************************************
  document.getElementById("strScore").oninput = function update(e) {
  var result = document.getElementById("strMod");
  var attribScore = $('#strScore').val();
  result.value = (Math.floor((attribScore / 2) -5));
  }
  ******************************************************************/
  var strScore = $('#strScore').val();
  var strMod = $('#strMod').val();
  var update = function(score, mod) {
      attribMod = (Math.floor(score / 2) - 5);
      mod.value = attribMod;
  };
  update(strScore,strMod);
  </code></pre>
  
  <p>When the left input is updated with an ability score, the right input should reflect the ability modifier.
  The commented section of javascript is perfectly functional, but I would really rather not have a separate function for every input that needs to be updated like this - one function is far easier to isolate and troubleshoot in the future. What I'd <em>like</em> to do is have one function to which I can pass the score and modifier input values as arguments (strScore and strMod in this case) and have it update the modifier field via the .oninput event. My attempt at this is below the commented section of javascript. I feel like I'm just not connecting the dots on how to call the function appropriately or correctly update the Modifier input passed to the function.</p>