Hi all :)
I want to make the toggle button so that it will display the specific hidden container..

for the example let say that i got all of these list of containers :

<div class="post_header">
  <div class="post_toggle">Show Post</div>
</div>
  <div class="post_container">
     <div>post content 1 goes here..</div>
  </div>

<div class="post_header">
  <div class="post_toggle">Show Post</div>
</div>
  <div class="post_container">
     <div>post content 2 goes here..</div>
  </div>

and I want to use jquery to do the toggling :

before,i ever use this :

<script type="text/javascript">
 $(document).ready(function(){

	$(".post_container").hide(); 

	$(".post_toggle").click(function(){
		$(this).toggleClass("active").next().slideToggle("fast");  
		return false; //Prevent the browser jump to the link anchor
	});
});
 </script>

but it seems doesnt work anymore for this problem as i now i need to find the specific div to be displayed.

Thus, how could i modified the above code?
Thanks for helping :)

Give them a unique ID. It wouldn't work because there are multiple elements having the same class name. It is ambiguous to a browser which element should be performed the toggle here. Sorry, I'm not very familiar with JQuery, so I can't show you much in JQuery.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.