I have a custom class called masked
on the body
tag. In the middle of the page, I have a DIV
with about 50% width and height of the page.
I am trying to attach a click handler only to the body.masked
selector, but the problem is that whenever the inner DIV
is clicked, the click handler on that body.masked
selector is also fired.
As if the DIV
in the middle is "transparent". How do I avoid that?
Here's some code:
$('body.masked').click(function(){
alert();
})
And HTML:
<body class="masked">
<div style="width:50%;height:50%;text-align:center;>Lorem ipsum</div>
</div>