You can do something like this:
$('#container').on('click', function (event) {
if (event.target != this) {
alert('You clicked a descendent of #container.');
} else {
alert('You actually clicked #container itself.');
}
});
This checks to see if the element that triggered the click event is the same to which it is bound.