Вопрос

following situation:

Table
  th
    tbody
       tr
         td
         td
         td
       tr
         td
         td
         td //I need this one crucial entry for my test

I tried and succeeded to access it on the browser console with this selector:

'.tableclasss tbody tr:last td:eq(2)'

but this fails if i use it in DalekJS becaus of the colons!

if I use

'.tableclasss tbody tr'

the selector finds the tablerows but as soon as i use a colon like:

'.tableclasss tbody tr:last'

the selection fails.

Any known issues about that?

Versions: Win7 dalek-cli 0.0.4 dalekjs local install: 0.0.8

Это было полезно?

Решение

Your Problem is that you mistake selectors that work within the jQuery selector engine & selectors that are defined in the CSS spec.

When you write tr:last you actually want tr:last-child or .tableclass tr:last-of-type etc.

Please go check this MDN page that explains the defined selectors & pseudo selectors, not all are supported by every browser, but most of them do work in modern browsers.

Другие советы

Try to use .last() and .eq() instead:

$('.tableclasss tbody tr').last().find('td').eq(2)
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top