Question: dont know if this is the correct stack exchange forum but i have the following puzzle 

i have two booleans and they have 4 possible combinations 

```
   X X
   X 0
   0 X
   0 0

```

2x2 = 4 , i thought

now i have three booleans, and i have those possible combinations

```
   X X X
   X X 0
   X 0 0
   0 0 0
   0 X X
   0 0 X
   X 0 X
   0 X 0

```

But there are only 8, i´m mentaly not able to find out the nineth combination,
is there one ? 

please Help me im stuck and always thought 3x3 = 9

Answer: 
The easiest solution is to check whether the target is a INPUT element(since there is only a checkbox in the div if the target is a INPUT element then it is the checkbox), if so don't do anything.

```
$('div').click(function (e) {
    if (e.target.tagName == 'INPUT') {
        return;
    }
    var elem = $('input[type=checkbox]', this);
    if (elem.prop("checked")) {
        elem.prop('checked', false);
    } else {
        elem.prop('checked', true);
    }
});

```

Demo: [Fiddle](http://jsfiddle.net/arunpjohny/9fuuq/)
Try using, event.stopImmediatePropagation(). This stops the other events happen.