title: How do I get the value of a submit button put into a global variable onclick?
body: <p>How do I get the value of a submit button put into a global variable onclick?</p>
  
  <pre><code>&lt;input type="submit" value="2"&gt;
  </code></pre>
  
  <p>How would I get the value of "2" to say a variable named subVal?</p>
  
  <p>For example, something like this:</p>
  
  <pre><code>&lt;script&gt;
  
  var subVal
  
  &lt;/script&gt;
  
  &lt;input type="submit" value="2" onclick="subVal = VALUE OF CURRENT SUBMIT THAT WAS CLICKED HERE"&gt;
  </code></pre>