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/)
You can use [e.stopPropagation()](http://api.jquery.com/event.stoppropagation/) for your `input`:

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

$('input').click(function(e) {
    e.stopPropagation();
});

```

**[Updated Fiddle](http://jsfiddle.net/AqLpf/1/)**

---

EDIT: Hope this is your requirement:

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

var radioStatus = false;
$.each($('input[type=radio]'), function () {
    // Set initial state of radio
    this.radioStatus = $(this).attr("checked") || false;
    $(this).data("status", this.radioStatus);
    // Set mouse-over event callback
    $(this).mouseover(function () {
        this.radioStatus = $(this).attr("checked") || false;
        $(this).data("status", this.radioStatus);
    });
    // Set on-click event callback
    $(this).click(function () {
        this.radioStatus = !$(this).data("status")
        $(this).attr("checked", this.radioStatus);
        $(this).data("status", this.radioStatus);
    });
});

```

**[Fiddle Demo](http://jsfiddle.net/fH6nE/5/)**