Jquery if element (':Visible')

Asked

Viewed 56 times

0

I’m trying to create an if so that if one div is visible, another one will disappear (in a wordpress template):

    jQuery(document).ready(function($){
       if($('.classe1').is(':visible'){
           $('.classe2').hide();
       }
});

But you’re not being recognized, what can I do?

  • some error message on console?

  • 1

    Voting to close as "typo" because of the answer.

1 answer

2

missed the last ) in the if if($('.classe1').is(':visible')...

$(document).ready(function($) { 
    if($('.classe1').is(':visible')) {
        $('.classe2').hide();
    }
});

Browser other questions tagged

You are not signed in. Login or sign up in order to post.