seletor jquery incapaz de encontrar o último filho visível
Aqui está o meu HTML:
<table id="dataTable" class="xLookup">
<thead id="PickerTHEAD">
<tr>
<th class="xSelBox"> </th>
<th style="display: none">Option ID</th>
<th>My Description</th>
<th>QTY</th>
<th>Unit Price</th>
<th style="display: none">nj1</th>
<th style="display: none">nj2</th>
</tr>
<tr>
...
</tr>
</thead>
<tbody>
...
</tbody>
</table>
E aqui está o meu seletor jquery:
$( "table#dataTable.xLookup thead#PickerTHEAD tr th:visible:last-child" )
Espero encontrar oúltima visível th
dentroPickerTHEAD
(qual seria<th>Unit Price</th>
), mas não encontra nada.
Se eu mudar meu seletor para remover o:visible
igual a...
$( "table#dataTable.xLookup thead#PickerTHEAD tr th:last-child" )
... então ele encontra<th style="display: none">nj2</th>
como esperado.
O que estou fazendo errado? Como posso selecionar o último visívelth
?