I want to check and uncheck (toggle) the radio when "td" is click but preserving the default input event
<table>
<tr>
<td>
<input type='radio'>
</td>
</tr>
</table>
My code attempts:
Try 1: http://jsfiddle.net/UJXRu/
Try 2: http://jsfiddle.net/UJXRu/1/
Try 3: http://jsfiddle.net/UJXRu/2/
Preview:
$("td").click(function(e) {
if (!$(e.target).is("input")) {
var bool = !$(this).children("input").is(':checked');
$(this).children("input").attr("checked", bool)
}
else{
var bool2 = !$(e.target).is(':checked');
$(e.target).attr('checked',bool2);
}
});