Lynx
Lynx

Reputation: 1482

Toggle click() with same class names?

I have a simple toggle that's going to be applied to more than one section of my web application. However, I do not want to just change the class name and add another event to trigger it.

Can I use something like parent() or nextUntil() to achieve this? What is usually the best practice for this situation?

https://jsfiddle.net/smod3dvp/

Upvotes: 0

Views: 21

Answers (1)

mylee
mylee

Reputation: 1333

use parents to find common identifiable parent and then use find like

$(this).parents(".information").find(".details").fadeToggle("fast");

Upvotes: 1

Related Questions