<table class="data" border="1">
<tbody>
<tr>
</tr>
<td><input type="checkbox" /></td>
<tr>
<td><input type="checkbox" /></td>
</tr>
<tr>
<td><input type="checkbox" /></td>
</tr>
</tbody>
</table>
When repeating each element, trcheck if this element is installed <tr>if it adds a new class. If not, delete it.
jQuery.fn.deleteMark = function() {
this.each(function() {
alert( $('input:checkbox',this) );
if ($('checkbox',this).is(':checked')){
$(this).addClass("delemarked");
}
else{
$(this).removeClass("delemarked");
}
})
};
Now I want to add a class to each tested one tr:
function refresh(){
$('.data tbody tr').each(function() {
$(this).deleteMark();
});
}
Unfortunately, this does not work for me. I will be grateful for any help.
source
share