Get an element's ancestor node based on it's id?
- From: harryajh <harryajh@xxxxxxxxxxx>
- Date: Thu, 31 Jan 2008 04:27:10 -0800 (PST)
Is it possible in JavaScript to to get the ancestor element of the <a>
element below that has an id beginning with 'panel'
<div id='panel1'>
<div>
<a href="#" onclick="closeDiv(getPanel());">Close</a>
</div>
</div>
The idea being is that the getPanel() returns the 'panel' element &
passes it as a parameter to the closeDiv() function without having to
explicitly specify 'panel1', 'panel2' etc...
I am trying to learn how to navigate the DOM but this has me stumped!
thanks in advance
harry
.
- Follow-Ups:
- Re: Get an element's ancestor node based on it's id?
- From: liamgegan@xxxxxxxxx
- Re: Get an element's ancestor node based on it's id?
- From: GArlington
- Re: Get an element's ancestor node based on it's id?
- Prev by Date: Re: Stopping navigation away from the page
- Next by Date: Re: Get an element's ancestor node based on it's id?
- Previous by thread: Submitting form via xmlhttp request
- Next by thread: Re: Get an element's ancestor node based on it's id?
- Index(es):
Relevant Pages
|