I have a problem. I am trying to toggle the checkboxes to add some css to the parent <tr>
This is what I still have
$('input[type=checkbox]').toggle(function(){ $(this).parents('tr').addClass('selectCheckBox', 970); }, function(){ $(this).parents('tr').removeClass('selectCheckBox', 970); });
However, the result of this is that <tr> gets selectCheckBox , but the checkbox is not checked. So I tried the following:
$('input[type=checkbox]').toggle(function(){ $(this).attr('checked',true); $(this).parents('tr').addClass('selectCheckBox', 970); }, function(){ $(this).attr('checked',false); $(this).parents('tr').removeClass('selectCheckBox', 970); });
Once again, no luck.
I believe this is due to how the checkbox id looks.
<input type="checkbox" name="select[]" id="select[]">
Then I tried to exit [] using \\[\\] as I used in the past, but no luck.
Is there a way to make a checkbox ?
source share