title: how to get javaScript event source element?
body: <p>Is there a way to retrieve the element source of an inline javaScript call?</p>
  
  <p>I have a button like this:</p>
  
  <pre><code>&lt;button onclick="doSomething('param')" id="id_button"&gt;action&lt;/button&gt;
  </code></pre>
  
  <p>Note:</p>
  
  <ul>
  <li>the button is generated from server</li>
  <li>I cannot modify the generation process</li>
  <li>several buttons are generated on the page, I have control only on client side.</li>
  </ul>
  
  <p>What I have tried:</p>
  
  <pre><code>function doSomething(param){
      var source = event.target || event.srcElement;
      console.log(source);
  }
  </code></pre>
  
  <p>On firebug I get <strong>event is not defined</strong></p>
  
  <p>Edit:
  After some answers, an override of the event handling using jQuery is very acceptable. My issue is how to call the original onClick function with it's original prameters, and without knowing the function name.</p>
  
  <p>code:</p>
  
  <pre><code>&lt;button onclick="doSomething('param')" id="id_button1"&gt;action1&lt;/button&gt;
  &lt;button onclick="doAnotherSomething('param1', 'param2')" id="id_button1"&gt;action2&lt;/button&gt;.
  &lt;button onclick="doDifferentThing()" id="id_button3"&gt;action3&lt;/button&gt;
  .
  .
  and so on..
  </code></pre>
  
  <p>So the override would be:</p>
  
  <pre><code>$(document).on('click', 'button', function(e) {
    e.preventDefault();
    var action = $(this).attr('onclick');
    /**
     * What to do here to call
     * - doSomething(this, 'param'); if button1 is clicked
     * - doAnotherSomething(this, 'param1', 'param2'); if button2 is clicked
     * - doDifferentThing(this); if button3 is clicked
     * there are many buttons with many functions..
     */
  });
  </code></pre>