A long time ago a friend made this for me:
$(".rnd1").click(function(){
$("*").click(function (event) {
event.stopPropagation();
$(this).fadeOut();
});
$('#random-button').hide();
$('#recover-button').show();
});
now i would like to protect some elements (like body and #recover-button) from fading out.
Beneath the answers of the others, which are correct of course, don’t forget that your “exceptional elements” should cover more in order to not make the whole document hideable.
So you will also need to make exceptions for
htmland the parent nodes of the elements, which you don’t want to be hidden, too. Only this prevents the user from not being able to hide them.