title: Pass element ID to Javascript function
body: <p>I have seen many threads related to my question title.</p>
  
  <p>Here is HTML Codes :</p>
  
  <pre><code>&lt;button id="button1" class="MetroBtn" onClick="myFunc(this.id);"&gt;Btn1&lt;/button&gt;
  &lt;button id="button2" class="MetroBtn" onClick="myFunc(this.id);"&gt;Btn2&lt;/button&gt;
  &lt;button id="button3" class="MetroBtn" onClick="myFunc(this.id);"&gt;Btn3&lt;/button&gt;
  &lt;button id="button4" class="MetroBtn" onClick="myFunc(this.id);"&gt;Btn4&lt;/button&gt;
  </code></pre>
  
  <p>And a very simple JS function is here :</p>
  
  <pre><code>function myFunc(id){
          alert(id);
  }
  </code></pre>
  
  <p>You can see in <a href="http://jsfiddle.net/h7kRt/" rel="noreferrer">JsFiddle</a>.</p>
  
  <p>The problem is :</p>
  
  <p>I have no idea, maybe doesn't pass <code>this.id</code> to <code>myFunc</code> function, or some problem else. </p>
  
  <p>What's the problem ?</p>
  
  <p>Any help would be appreciated.</p>