Here is my current code:
$(".close_btn").click(function(e) {
$(".box1").fadeOut(100);
$(".box2").fadeOut(100);
});
As you see, currently, when you click on .close_btn
, both .box1
and .box2
will be hidden. Now I want to use $(this)
and .closest()
to hide just one box (the parent of clicked .close_btn
, there are two .close_btn
). I mean I want something like this:
$(".close_btn").click(function(e) {
$(this).closest(".box1" OR ".box2").fadeOut(100);
});
Is doing that possible?