unlocked291
Technical User
Hi.
Everywhere I see functions that go down the branches from the higher elements to lower ones. It seems easy this way to search if a selected object it is or it is not part of a determined parent. I am wondering if there is a way for doing it from the lower element, without going down the branch by selecting siblings, but going up by selecting parents?
For example:
...
<form>
...
<div> <p>A</p> </div>
</form>
<p>B</p>
We take as reference "form". How will look a function that tells me the text node "A" is under the "form" node; and when applied to "B" it tells me it is not. I want to go up the branches (brake on body I guess), not the other way around.
Everywhere I see functions that go down the branches from the higher elements to lower ones. It seems easy this way to search if a selected object it is or it is not part of a determined parent. I am wondering if there is a way for doing it from the lower element, without going down the branch by selecting siblings, but going up by selecting parents?
For example:
...
<form>
...
<div> <p>A</p> </div>
</form>
<p>B</p>
We take as reference "form". How will look a function that tells me the text node "A" is under the "form" node; and when applied to "B" it tells me it is not. I want to go up the branches (brake on body I guess), not the other way around.