Reputation: 41
My HTML table contains a set of tags (anchor, plain text,line break etc) inside each cell.
Now my question is i need to get all the contents of the table cell into an array, like if the cell contains anchor and plaint text i need both into an array. In this way i need to get a number of arrays (equal to the number of cells)
i tried this
$(document).ready(function() {
var row = 4;
var items = [];
$('#test tr:eq(' + row + ') td').each(function(colindex, col) {
//alert(t);
items.push(t);
});
alert(items.toString());
});
but this is giving me all the cells into an array where as i need each cell to give me an arrray.
can any one please help me out here.
thanks in advance
Upvotes: 0
Views: 1116
Reputation: 21979
You can use .children()
.
$('element selector').children()
See http://api.jquery.com/children/
Upvotes: 1