When I click on these divs they are hidden, I want to achieve that when a user hides all the divs a div with a message is activated, but only when I finish hiding them all.
<div class='open'>Ocultar 1</div>
<div class='open'>Ocultar 2</div>
<div class='open'>Ocultar 3</div>
<div class='open'>Ocultar 4</div>
<div class='open'>Ocultar 5</div>
/* DIV A MOSTRAR */
<div class='oculto'>-CONTENIDO MENSAJE-</div>
<script>
$(document).ready(function(){
$(".open").click(function(){
$(this).hide();
});
});
</script>
I have created a method that through the function
is()
checks if there is any element of the.open
visible class. If there is one, it returnstrue
if it does not exist, it returnsfalse
. When doing aclick
in each of the elements to hide, I verify that after hiding that there are still visible elements. If there are not, it is when I show the<div>
with the class.oculto
.