deathcaller
deathcaller

Reputation: 41

jquery select all tags inside a html table cell

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

Answers (1)

Rudi Visser
Rudi Visser

Reputation: 21979

You can use .children().

$('element selector').children()

See http://api.jquery.com/children/

Upvotes: 1

Related Questions