How To Toggle Class Of Closest Element
I am using the below code to click on an image within the .process class and when clicked the .process-info with toggle class of .process--shown. This code works; however, it will
Solution 1:
Use this
current element context to traverse up to common parent using .closest()
then use .find()
$(".process .process--img").click(function () {
$(this).closest(".process").find(".process--info").toggleClass("process--shown")
});
Post a Comment for "How To Toggle Class Of Closest Element"