visible selector in jquery



To see if an element is visible or not, you can use the visible selector with the is function:
$("#idElement").is(":visible") // true or false

JQUERY CODE:
 $(document).ready(function() {

   $("#collapse").on('click', function() {

   if($('#flex-container').is(':visible'))
    {  $("#flex-container").hide();  }
    else 
    {  $("#flex-container").show();  } 

   });
 });

No comments:

Post a Comment