title: How to read value of Textbox which is inside table
body: <p>I need to read the value of textbox which is inside the table.</p>
  
  <p>Following is how I create table.</p>
  
  <pre><code>var theader = '&lt;table border = "1" id = "MarksTable"&gt;\n';
  var tbody = '';
  
  for ( var i = 0; i &lt; total_rows; i++) {
      tbody += '&lt;tr&gt;';
      for ( var j = 0; j &lt; total_col; j++) {
          tbody += '&lt;td name=' + "cell" + i + j + '&gt;';
          if (i &gt; 0) {
              tbody += '&lt;input type="text" value = "marks" name="inputcell1'+j + '"&gt;';
          } else {
              tbody += '&lt;b&gt;' + subjectList[j] + '&lt;/b&gt;';
          }
          tbody += '&lt;/td&gt;';
      }
      tbody += '&lt;/tr&gt;\n';
  }
  var tfooter = '&lt;/table&gt;';
  document.getElementById('wrapper').innerHTML =  theader
          + tbody + tfooter ;
  </code></pre>
  
  <p>and below is my attempt to read text box value:</p>
  
  <pre><code>function readTableData(){
      var marks = [];
      var table = document.getElementById("MarksTable");
      var column_count = table.rows[1].cells.length;
      var row = table.rows[1];
      if(column_count&gt;0){
          for(var index = 0; index &lt; column_count;index++){
              marks[index] = row.cells[index].innerHTML;
          }
      }
      return marks;
  }
  </code></pre>
  
  <p>Here, <code>row.cells[index].innerHTML</code> gives the output <code>'&lt;input type="text" value = "marks" name="inputcell10"&gt;</code>.</p>