[thelist] DOM list elements only within another element

Simon Perry thelist at si-designs.co.uk
Fri Jul 2 07:20:44 CDT 2004


Hi List,_

_I want to apply some behaviors to one set of elements within my page 
but not any others. As an example imagine the following;

<div id="navcontainer">
<ul>
<li><a href="">home</a></li>
<li><a href="">products</a></li>
<li><a href="">help</a></li>
</ul>
</div>
<div id="content">
<h1>Fruit</h1>
<ul>
<li><a href="">Apple</a></li>
<li><a href="">Orange</a></li>
<li><a href="">Pear</a></li>
</div>
 
Now I would like to add a behaviour to all the <a href=""> in the top 
"navcontainer" div but not the "content" div. Is there an easy way to do 
this? Or will I have to get all <a> elements then check they are in an 
<li> block then check that that <li> is in the required div?

TIA

Simon



More information about the thelist mailing list