title: How to get a cell Value in table using Javascript
body: <p>I have written this function to get cell values of a table in Javascript. Using <strong>innerHTML</strong> is returning cell value along with HTML code.Going through some forums got to know innerText should be used to get value of the cell.But it is returning empty in my condition.</p>
  
  <p>Below is the Script i am using.</p>
  
  <pre><code>function validateMyFunction() {
      var sTableName = document.getElementById("tablename");
      alert("sTableName&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+sTableName);
      alert("sTableName&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;"+sTableName.rows.length);
      for (var i=0;i&lt;sTableName.rows.length;i++) {
          var col1= sTableName.rows[i].cells[11].innerText;
          var col2= sTableName.rows[i].cells[9].innerText;
      }
  }
  </code></pre>
  
  <p>Can anyone please help with any alternatives for this.</p>
  
  <p>Thanks.</p>