I have the following code:
<select id="deloptions">
<option value="none">Select none</option>
<option value="all">Select all</option>
</select>
I'm trying to check all theck and uncheck all the checkboxes from a table which is placed after this select. The checkboxes are placed in the 1st collumn of the table. They all have "delme" class. I've tried everything but it doesn't seem to work... Here is my current code:
$('#deloptions').change(function(){
var value = $(this).val();
if (value == 'all') {
$('input:checkbox').prop('checked', true);
} else {
$('input:checkbox').prop('checked', false);
}
});
I've tried using their class too but no success... like:
$('.delme').prop('checked', false);
Trying reaching for the table didn't work either... so i'm kindda stucked.
EDITED:
<table>
<tr>
<th></th>
<th>Title</th>
<th>Content</th>
<th>Date Added</th>
<th>Actions</th>
</tr>
<tr id="37">
<td><input type="checkbox" class="delme" id="37"></td>
<td>Good news!</td>
<td>This is a message!</td>
<td>2013-07-22</td>
<td>Here is a button</td>
</tr>
</table>