0

for example, let's say there was this html:

<div>
  <div id="divchild"></div>
</div>

Would there be a way to access the parent div from the child elements namespace such as:

$$('#divchild'){
  # Access parent div here
  $$('< div'){
    # somethere here
  }
}

Is there a way to take the non working example and make it work? thank you.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Dirk Dunn
  • 363
  • 2
  • 3
  • 14

1 Answers1

1

not with the css selectors.You'll need to use xpath selectors:

$(".//div[div[@id='divchild']]") {
    # something here
}

or

$(".//div[@id='divchild']/parent::div") {
    # something here
}

would select the parent div.

Cagri
  • 68
  • 4