title: JavaScript Get data of a clicked row
body: <p>Good Evening, i want to get all the data from the row that the user clicks on, so i tried this script, it gets the row id but it doesn't get the data exists in that row, i push every data in that row to an array for further uses:</p>
  
  <pre><code>    function findRowNumber() {
      var rowIdx;
      var rowData = new Array();
      var table = document.getElementById('product_table');
      var rows = table.getElementsByTagName('tr');
      var selectedRow;
      var rowCellValue;
      for (i = 0; i &lt; rows.length; i++) {
          rows[i].onclick = function() {
              rowIdx = this.rowIndex;
              selectedRow = rows[rowIdx];
              for (j = 1; j &lt; selectedRow.length; j++) {  // it doesn't enter that loop
          rowCellValue = selectedRow.cells[j].value;
          rowData.push(rowCellValue);
          alert("Value " + rowCellValue);
  
      }
          }
      }
  
  
  }
  </code></pre>