Q1: I create a “jQuery clickable” I want when click on input:checkbox in rows checked it input:checkbox(like when click on rows)
Q2: I want when click on input:checkbox(no row) in “first row(tr)” select all check boxes?
EXAMPLE: http://jsfiddle.net/tKBJ2/3/
$('.table_show tr, .table_show tr input[type="checkbox"]').live('click',function(){
checkBox = $(this).find("input").prop('checkbox', true);
$id = $('input:checkbox:checked').val();
if (checkBox.prop('checked')) {
$(this).css('backgroundColor', "");
checkBox.prop('checked', false);
}
else {
checkBox.prop('checked', true);
$(this).css('backgroundColor', "#ffd6c1");
}
});
With respect
Q1:
http://jsfiddle.net/tKBJ2/7/
Problem is that when you click the checkbox, it directly sets the checked property, and you directly set it back.
EDIT:
I changed it quite a lot more, but it works:
http://jsfiddle.net/tKBJ2/35/
Though to be honest, I’d put the header in a thead, so you don’t have to make an exception for the first row.