You need to by pass event code when source of event is not td with class onoff
, You can do this way.
$(function() {
$("td.onoff").click(function(event) {
if(event.target.className != 'onoff') return;
var objCheckbox = $(this).find("input[type=checkbox]");
if( objCheckbox.length >= 1 ) {
objCheckbox.prop("checked", !objCheckbox.prop("checked"));
}
});
});