title: this.getAttribute is not a function
body: <p>I am new to Javascript. I want to write a javascript code that when I click a button, the alert window pops up and writes data-message attribute. Here is my code:</p>
  
  <pre><code>&lt;button type="button" data-message="a1" onclick="pop()"&gt;click&lt;/button&gt;
  
  &lt;script&gt;
    function pop() {
      alert(this.getAttribute("data-message"));
    }
  &lt;/script&gt;
  </code></pre>
  
  <p>but I get the error</p>
  
  <pre><code>TypeError: this.getAttribute is not a function
  alert(this.getAttribute("data-message"));
  </code></pre>
  
  <p>I have two questions:</p>
  
  <ol>
  <li><p>What is wrong?</p></li>
  <li><p>How can I debug this? How can I find out what <code>this</code> refers to? I am using firebug.</p></li>
  </ol>
  
  <p>Thanks a lot.</p>