title: How to get html <td> values using javascript?
body: <p>Im very new to html and javascript.</p>
  
  <p>I want to get the content of  element whenever the user click on a table row using javascript.</p>
  
  <p><b><code>test.html</code></b></p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script text="text/javascript"&gt;
  function dispTblContents() {
   var pName = document.getElementById("pName").value;
   var pAddress = document.getElementById("pAddress").value;
   var pEmail = document.getElementById("pEmail").value;
  
   alert(pName + " " + pAddress + " " + pEmail);
  }
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
   &lt;table&gt;
    &lt;thead&gt;
          &lt;tr&gt;
              &lt;th&gt;Name&lt;/th&gt;
              &lt;th&gt;Address &lt;/th&gt;
              &lt;th&gt;Email&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
  
      &lt;tbody&gt;
          &lt;tr onclick="dispTblContents();" &gt;
              &lt;td id="pName"&gt;Ricardo Lucero&lt;/td&gt;
              &lt;td id="pAddress"&gt;Mexico City, Mexico&lt;/td&gt;
              &lt;td id="pEmail"&gt;rlucero@test.com&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tbody&gt;
  
   &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Whenever I click the row it displays <code>undefined undefined undefined</code>. I know my code is wrong but I really don't how to fix this. Can somebody please help me. Im very new to this thing. Thanks in advance.</p>