title: How to perform two tasks on a single button click or event
body: <p>I have a button on clicking it, it increments the count value by calling the function incrementIndex. But i would also like to add a String to the array list for the same event.
  A simple code snippet is provided below. </p>
  
  <p><strong>Java Script</strong></p>
  
  <pre><code>var count=0;
  function incrementIndex() {
  count += 1;
  }
  </code></pre>
  
  <p><strong>ArrayList</strong></p>
  
  <pre><code>&lt;%
  ArrayList arr= new ArrayList();
  String ele="3,2";
  %&gt;
  </code></pre>
  
  <p><strong>Button:</strong></p>
  
  <pre><code>&lt;button onclick="incrementIndex()"&gt;Button 1&lt;/button&gt;
  </code></pre>