I want to show the different elements in the loop when I click on body, except from the element #search-container form. It works, but only if I first click on the element #search-container form, and it only works once.
$('html').click(function(event) {
$('#search-container form').click(function(event){
event.stopPropagation();
});
$('html').on('click',function() {
$('#small-search a').toggleClass('notvisible');
$('#session').toggleClass('notvisible');
$('#search-container').css('position','absolute');
$('#search-container form').toggleClass('visible');
});
});
$('html').not("#search-container form").on('click',function(){
$('#small-search a').toggleClass('notvisible');
$('#session').toggleClass('notvisible');
$('#search-container').css('position','absolute');
$('#search-container form').toggleClass('visible');
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With