Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>Table to Array</title>
</head>
<body>
<table id="tblVersions">
  <thead>
    <tr>
        <th> Header1 </th>
        <th> Header2 </th>
        <th> Header3 </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td ><input type="checkbox" value="0">Value 1,1</td>
        
        <td> Value 2,1 </td>
        <td> Value 3,1 </td>
    </tr>
    <tr>
        <td ><input type="checkbox" value="1" checked="checked">Value 1,1</td>
        <td> Value 2,2 </td>
        <td> Value 3,2 </td>
    </tr>
    <tr>
        <td> Value 1,3 </td>
        <td> Value 2,3 </td>
        <td> Value 3,3 </td>
    </tr>
  </tbody>
</table>
  
</body>
</html>
 
$(function() {
  
  var headers = $("span",$("#tblVersions")).map(function() { 
    return this.innerHTML;
  }).get();
  
  var rows = $("tbody tr",$("#tblVersions")).map(function() { 
    return [$("td:eq(0) input:checkbox:checked",this).map(function() { 
      return this.innerHTML;     
    }).get()];
  }).get();
  
  alert(rows);
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers