0

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 :)

Edited by samsons17: n/a

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Taywin
0

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.

Edited by Taywin: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.