This is not a mistake, but it is definitely confusing. Which will give you the result you expect:
$('table td:nth-child(3) a')
While: nth-child and: eq seem very similar, the behavior may be completely different, as can be seen from the expected result.
The jQuery documentation on this subject can be found here . It states:
The nth-child (n) pseudo-class is easily confused with: eq (n), although the two can lead to completely different matched elements. Using nth-child (n), all child elements are taken into account, regardless of what they are, and the specified element is selected only if it matches the selector attached to the pseudo-class. Using: eq (n), only the selector attached to the pseudo-class is counted, not just the children of any other element, and the nth is selected.
In simpler words, eq (2) selects the third element in the while result set: nth-child (3) selects 3 children of its parent. And in this case, his parent will be tr.
source share