开发者

jQuery selector needed to select all 'p' tags in a table row

Hi I开发者_JS百科 have some tables in my page. The first row of each table is normal but the rest of the rows are hidden by giving the tr tag a class of hidden. There is a link in the first row to show more info (fade in the hidden rows) which currently uses this selector:

$(this).closest('tr').nextAll("tr.hidden").fadeIn()

However within the hidden rows there are some p tags with a class of hiddentext that I would like to select in order to do something to but I can't seem to get a selector working that does this. Iv tried doing things like:

$(this).closest('tr').nextAll("tr.hidden > p.hiddentext")
$(this).closest('tr').nextAll(".hidden").nextAll('td > p.hidden')

Can't get it to work though. Any help would be very much appreciated.

Thanks


Try this:

$(this).closest('tr').nextAll(".hidden").find('p.hiddentext');

That would select all p.hiddentext inside the hidden rows. You can even chain the fadeIn() and selecting of p's in one command:

$(this).closest('tr').nextAll(".hidden").fadeIn().find('p.hiddentext').doSomething();
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜