// Vanilla js
var ignoreMe = document.getElementById("ignoreMe");
window.addEventListener('mouseup', function(event){
if (event.target != ignoreMe && event.target.parentNode != ignoreMe){
// Place your output
}
});
$(document).click((event) => {
if (!$(event.target).closest('#element').length) {
// the click occured outside '#element'
}
});