Y
Yanick
Is it possible, with JQuery to get only one specific element ancestor ?
For example :
<div>
<ul id="tree">
<li><a>Item 1</a>
<ul id="subTree">
<li><a>Item 1.1</a></li>
</ul>
</li>
</ul>
</div>
$('ul li a').click( function() {
// get first UL here
} );
That is, if I click on "item 1" I want to get the "tree" DOMelement,
and when I click on "item 1.1" I want to get the "subTree" DOMelement
only. How can this be achieved ?
For example :
<div>
<ul id="tree">
<li><a>Item 1</a>
<ul id="subTree">
<li><a>Item 1.1</a></li>
</ul>
</li>
</ul>
</div>
$('ul li a').click( function() {
// get first UL here
} );
That is, if I click on "item 1" I want to get the "tree" DOMelement,
and when I click on "item 1.1" I want to get the "subTree" DOMelement
only. How can this be achieved ?