title: How can I make my function run when a value is changed instead of when the button is clicked?
body: <p>I have multiple text boxes now I want to find minimum value from them in a text box as result.</p>
  
  <p>I have this working when I click the button, I need this to update when a change is made in any of the textboxes though not using the onclick event. How do I do that?</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>function minimum() {
    var a = document.getElementById("1").value;
    var b = document.getElementById("2").value;
    var c = document.getElementById("3").value;
    var d = document.getElementById("4").value;
    var m = Math.min(a, b, c, d);
    document.getElementById("5").value = m;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" class="a1" id="1" value="1" /&gt;
  &lt;input type="text" class="a1" id="2" value="2" /&gt;
  &lt;input type="text" class="a1" id="3" value="3" /&gt;
  &lt;input type="text" class="a1" id="4" value="4" /&gt;
  &lt;input type="button" onclick="minimum()" value="MIN" /&gt;
  
  &lt;br /&gt;&lt;br /&gt;
  &lt;input type="text" class="a2" id="5"&gt;</code></pre>
  </div>
  </div>
  </p>