tags:

views:

219

answers:

1

i have the code below

<div id=topbar>
<a class="nav" href="#" onClick="if($('#embedding').css('display') == 'none') { $('#embedding').show('fast'); } else { $('#embedding').hide('fast'); } return false;">Show Details</a>
<div id=embedding>Content</div>
</div>

In the link to show the embedding layer, is there any way instead of putting #embedding, i can do something so it grabs the next div so i can use this dynamically?

Wanting to use this to format some MySQL results in PHP.

UPDATE for those who are wondering, this is the solution

<a class="nav" href="#" onClick="if($(this).next('div').css('display') == 'none') { $(this).next('div').show('fast'); } else { $(this).next('div').hide('fast'); } return false;">Show Details</a>
+2  A: 

Use next() method of jquery object:

<a href="#" onclick="$(this).next('div').toggle();">Toggle next div</a>
Anatoliy
How would i literally impose this code on my example above?
Patrick
nm, got it. Thanks!
Patrick