You can use the event argument to see which target was clicked and return false
$("html, body").click(function(e) { if ($(e.target).hasClass('entry-content')) { return false; } alert('d'); });β
http://jsfiddle.net/keyZw/
You are using the .not () filter, but it is still part of your html / body .., so you need to handle it inside the click function. Also you just bind the click event.
So,
// find html,body - not ones with class=entry-content - bind click $("html, body").not('.entry-content')
Thus, this does not prevent the warning, since your div is still inside the body.
As mentioned, you only need to get attached to the body really
$("body").click(function(e) { if ($(e.target).hasClass('entry-content')) { return false; } alert('d'); });β
source share