This is kinda pseudocodish, but it should do what you want: $('button selector').click(function() { $('table tr').each(function() { x = $(this + 'td:eq(1)'); //should grab the second td y = $(this + 'td:eq(2)'); //should grab the third td push(array,[x,y]); }); });
Of course if you have multiple tables you'll be iterating over all of them, so you may need to an id to the table so that you can use that to select the proper table.