Question

What would the equivalent of the following jQuery selector:

$('table.special > thead > tr')

be if I had $('table.special') as a $table argument in function to start with?

(something of the form $table.(...) but equivalent to the first mentioned selector)


Note: $table.filter('thead > tr') is not what I want, as it also selects thead element of nested tables, and $table.filter('> thead > tr') doesn't work and neither $table.children('thead > tr')...

Was it helpful?

Solution

This is how it can be done:

$table.children("thead").children("tr");

As well as:

$table.find("> thead > tr");
// or
$("> thead > tr", $table);

but for some reasons this type of selector is deprecated now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top