jQuery | Detect Click Outside of the Element

// Hide Div when Click Outside of the Element using jQuery / https://www.codexworld.com/
$(document).mouseup(function(e){
    var container = $("#elementID");
    // If the target of the click isn't the container
    if(!container.is(e.target) && container.has(e.target).length === 0){
        container.hide();
    }
});

This website may contain fan art inspired by existing characters from films, TV shows, or games. I don't own any rights to those characters — any copyright owner wishing to have a fan art removed can contact me here. This is a personal portfolio and store. It uses only the essential cookies needed for the site, cart, and account to work — no analytics, no tracking, no advertising.