I know this question have already been answered in this link but what if i only want to check the checkbox beside the other checkbox.
just is like this
+-------------------------------+
|column1 | column2 |column3 |
+-------------------------------+
|check here | ✓ | ✓ |
+-------------------------------+
|butnothere | □ | □ |
+-------------------------------+
I've tried this function
$('#chk1, #chk2').on('click', function(){
var checked = $(this).is(':checked');
$('#chk1, #chk2').attr('checked', checked);
});
but it checks all of my checkboxes like this.
+-------------------------------+
|column1 | column2 |column3 |
+-------------------------------+
|check here | ✓ | ✓ |
+-------------------------------+
|butnothere | ✓ | ✓ |
+-------------------------------+
here is my html table(short copy).
<tr>
<td width="20">
<input id="chk1" type="checkbox">
<input id="chk2" type="checkbox">
</td>
</tr>
just like the one from above.