Home > Programming > Problem with jQuery 1.3 and :eq in a complex selector

Problem with jQuery 1.3 and :eq in a complex selector

While trying to recreate this XPath as a jQuery selector I ran into some unexpected difficulties:

/html/body/table[3]/tbody/tr/td/table/tbody/tr

My first attempt to convert it looked something like this:

$("body > table:eq(2) > tbody > tr > td > table > tbody > tr")

This gave no results. I simplified it a little bit,

$("body > table:eq(2) tr tr")

Still no luck. After experimenting for a while it looked to me like :eq wasn’t playing well in this expression. The following worked:

$("body > table").eq(2).find('tr tr')

Weird.

Be Sociable, Share!
  1. No comments yet.
  1. No trackbacks yet.