For reliability reasons, I would recommend against using :nth-* or :contains for this purpose. Instead, I would select .kn-table-totals and then use normal array operations like .find() or .filter() to find the value you’re looking to target.
Nevertheless, here’s why your selector isn’t working: :nth-* selectors do not count instances of a selector in the document. Instead, they select nth instances among a list of siblings, that also happen to match the selector.
If you want to select the second instance of .highlight, you might try .highlight:nth-child(2). But that’ll actually select the first instance of .highlight because it is the second among its siblings. For this reason,.highlight:nth-child(4) will actually select the second instance of .highlight. Meanwhile, :nth-of-type behaves just like :nth-child with the added stipulation of selecting among siblings of the same type.
Thankfully, with the introduction of CSS Level 4, we now get of S notation! It is already supported by all major browsers, so it should be pretty safe to use. Now, to select the second instance of .highlight in the example above, we can use :nth-child(2 of .highlight) .