Reputation: 1824
I'm very new to jQuery.
I wrote this code to select child TD elements.
$(this)
.children("div.tablescroll_wrapper")
.children("table.tablescroll_body")
.children("tbody")
.children("tr.first")
.children()
It works fine but looks bad, Is there a better way to do this?
Sorry for my low level English and thank you
Upvotes: 2
Views: 3033
Reputation: 3436
you don't have to navigate the entire tree. Just setting an id to the table or selecting tr directly will work:
$(this).find('tr:first').children();
is good enough. Otherwise, select the table with the id of the table:
Upvotes: 0
Reputation: 87083
$('div.tablescroll_wrapper > table.tablescroll_body > tr.first', this).children();
or
$('div.tablescroll_wrapper > table.tablescroll_body > tr.first > *', this);
Upvotes: 0
Reputation: 13461
I am not sure about your html structure, but what you are trying to achieve can be achieved with,
$(this).find("div.tablescroll_wrapper tr.first").children();
Upvotes: 5