Last active
September 9, 2020 11:35
-
-
Save fabriziofeitosa/725135bef851f563311d9f74c291e885 to your computer and use it in GitHub Desktop.
(JS) (jQuery) Click fora da área
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function () { | |
$("body").on("click", function (e) { | |
// Defina o alvo | Ex.: ".notificacao,.boxPerfil" | Não faz nada se for o alvo. | |
if ($(e.target).closest(".notificacao,.boxPerfil").length) return; | |
// O que deve ser feito caso não seja o alvo? | |
console.log("Você clicou fora do alvo!"); | |
document.getElementById("optNotif").checked = false; | |
document.getElementById("optMenu").checked = false; | |
}); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment