$(function () {
$max = 4;
$i = 1;
for ($i = 1; $i < 3; $i++) {
$('#itemListLeading table tr :nth-child(' + $i + ')').each(function () {
$length = $(this).children().text().length;
if ($length > $max) {
$max = $length;
}
$('#itemListLeading table tr :nth-child(' + $i ' +)').promise().done(function () {
$(this).css("min-width", $max * 8 + "px");
});
});
};
});
Not sure why this here doesn't work. I'm trying to pass '1' and '2' and maybe more later to the nth-child(). It works on a single nth-child(1), ie. without the for loop. Or is there a better way of passing x amount of variables to run through the function?