hi how can i select empty space in the window using jquery -
hi want part of code executed when click on empty space in window there nothing no p
no div
nothing still see console code if click on p
in window,so if there way tackle problem appreciate help.
$(document).on("click", ":not(div, p)", function(){ console.log("you clicked nothing empty zone in window" ); });
make sure click in body
element. works if have span
, a
, button
, etc. elements.
$('body').click(function (e) { if (e.target == this) { //your code here } });
Comments
Post a Comment