stoppropagation - Function triggered when click outside an element in jQuery -


i want show different elements in loop when click on body, except element #search-container form. works, if first click on element #search-container form, , 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'); }); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -