-2

I got 3 cards, class"cards", also gave them class "1card, 2card, 3card". When i am trying to put this code in doesn't work why? i want the first card to be hidden once i click on 2nd and 3d card

    $(".cards").on("click", function(){
if ($(".1card")){
    $(".2card, .3card").slideUp(1000);
} else {
    $(".1card").slideUp(1000)
}
})

1 Answers1

0

Trigger other two elements on click event to hide the first one

$('.2card, .3card').on('click', function (){
  $('.1card').hide();
});