I have a table, and I\'m trying to find the width of each td in the table. I\'ve tried all kinds of variations of: $(\"td\")[0].width()
, but none of them work,
while you said I'm trying to find the width of each td in the table so you need to loop through tds by using .each()
..
$('td').each(function(){
alert($(this).width());
});
and to select specific td there are more ways
by using :eq()
selector
$('td:eq(0)'); // index start from 0
or .eq()
in jquery
$('td').eq(0) // index start from 0
or :nth-child()
selector
$('td:nth-child(1)'); // index start from 1