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

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -