Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With jQuery, is it possible to daisy-chain selectors?

Is it possible in jQuery to daisy-chain selectors like so?

var sData = $('#myTableRow TD:nth-child(3):nth-child(2)').html();
like image 764
Volomike Avatar asked Mar 09 '10 22:03

Volomike


2 Answers

Perhaps you mean:

$('#myTableRow TD:nth-child(3) :nth-child(2)')

Which would be the 2nd child of the 3rd <TD>?

like image 138
Dean Harding Avatar answered Sep 30 '22 00:09

Dean Harding


Yes, but that one in particular makes no sense, since the same <td> cannot be both the 3rd and the 2nd child of its parent. You can however combine multiple "pseudo-class" qualifiers that do make sense when applied together, like ":text:hidden" for example.

like image 38
Pointy Avatar answered Sep 29 '22 23:09

Pointy