i’m using jQuery’s toggle method to hide/show a page element when another page element is clicked on.
jQuery('a#mobile-search-icon).click(function(){
jQuery(‘#searchBox’).toggle('slow');
});
but in addition to that, if the user clicks anywhere on the document except for that element, i’d like that element to fadeout. what’s a line of code to use for that?
my pseudo code would read something like,…
$(‘anywhere except #searchBox’).click(function(){
$(‘#searchBox’).fadeOut();
})
i know there’s a jQuery not selector but i’d prefer to use something else. the not selector would be too processor intensive.