开发者

select odd with several tables on the site?

EDIT

Hi. I got 1 page(html) where I got a couple of tables. I want so within each table every odd row got a class. My problem is it only take the first table and go on with the odd on to the others to, when it just suppose to do that with in that one table, stop, start over with the next table. like this table, every other row, add class, next table, every other row, add class. NOW it's like table, every other row for all the tables. U know?

EDIT Reason I want it to go into each table is because this is a menu and each menu got this structure.

table

1:st tr, title

2:nd tr, menu

3:rd tr, menu

and so on

If I just do a tr:odd it will just keep going with addClass and on the next table it will mess up my title, you know?

I tried two different ways both wont work the way I would like them to. regular and each

$开发者_JS百科.each( {'.tableMenu'}, function () {
            $('table.tableMenu tr:odd').addClass('tableSubMenu');
});


$('table.tableMenu tr:odd').addClass('tableSubMenu');


You forgot to add each loop.

$('table.tableMenu').each(function(){
    $(this).find("tr:odd").addClass('tableSubMenu');
});

See working demo http://www.jsfiddle.net/MpQth/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜