Jquery toggle

have three posts on a page.

each have a a bioHeader & a bio section.

I am trying to figure out how on click only one of the bio per post is toggled off/on

	$( ".bioHeader" ).click(function() {
	  $( ".bio" ).toggle();


That code is doing it for all of them. Looking into a this
But not sure.
Could i please get some advice on this one?

I like slideToggle() a little bit better:jQuery Toggle

first I wanted it to work, then refine it. So this worked.

$( ".bioHeader" ).click(function() {

$('.bio').on('click', function (event) {

Why do you need that extra js?

It seems that .bio is not inside bioHeader so shouldn’t be an issue?

It is generally best to avoid using stopPropagation as it may cause other issues further down the line.

am open to suggestions.
This is wp. so there are several posts all w/the same classes.

That doesn’t seem to answer my question :slight_smile:

The first part of the code should be doing what you want assuming that the header is the trigger for the open and close. The .bio element would seem to have no part to play in this process hence my question?

ok see what you mean.
yep. works.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.