On Nov 17, 2007, at 12:05 PM, Glen Lipka wrote:
$("ul").prev("span");
Or, in the case of clicking on the span, you'd probably want to do this:
$(document).ready(function() {
$('span.trig').click(function() {
$(this).next('ul').slideToggle();
});
});
just copy, paste, and enjoy. :-)
--Karl
Check out this page: http://docs.jquery.com/Traversing
You would be surprised how easy is it to find things in a relative
manner.
Glen
On Nov 17, 2007 7:00 AM, the_ghost < [EMAIL PROTECTED]> wrote:
I have such html code:
<ul>
<li><span class="trig">Elements Set 1</span>
<ul>
<li><a href="#">Element 1</a></li>
<li><a href="#">Element 2</a></li>
<li><a href="#">Element 3</a></li>
<li><a href="#">Element 4</a></li>
<li><a href="#">Element 5</a></li>
</ul>
</li>
<li><span class="trig">Elements Set 2</span>
<ul>
<li><a href="#">Element 11</a></li>
<li><a href="#">Element 22</a></li>
<li><a href="#">Element 33</a></li>
<li><a href="#">Element 44</a></li>
<li><a href="#">Element 55</a></li>
</ul>
</li>
<ul>
The idea is to slideToggle() nested <ul> when clickng <span>. So, i
need to point <ul> i need. I don't now how to point jquery look for
element, wich is next to just clicked one...