HTML Table's:
/* one table */
<table class="table borderless" id="cegadatok">
<tr class="info">
<td width="5%"><input type="checkbox" class="checkAll" value="89"></td>
<td width="25%">Company name</td>
<td width="20%">Email address</td>
<td width="35%">Address </td>
<td width="15%">Tax numver</td>
</tr>
</table>
<table class="table borderless" id="tetelek" style="width: 90%;" align="right">
<tr>
<td width="5%"><input type="checkbox" value="1"></td>
<td class="warning">1</td>
<td class="warning">2</td>
<td class="warning">3</td>
</tr>
<tr>
<td width="5%"><input type="checkbox" value="2"></td>
<td class="warning">4</td>
<td class="warning">5</td>
<td class="warning">6</td>
</tr>
<tr>
<td width="5%"><input type="checkbox" value="3"></td>
<td class="warning">7</td>
<td class="warning">8</td>
<td class="warning">9</td>
</tr>
</table>
/* Two table */
<table class="table borderless" id="cegadatok">
<tr class="info">
<td width="5%"><input type="checkbox" class="checkAll" value="90"></td>
<td width="25%">Company name</td>
<td width="20%">Email address</td>
<td width="35%">Address </td>
<td width="15%">Tax numver</td>
</tr>
</table>
<table class="table borderless" id="tetelek" style="width: 90%;" align="right">
<tr>
<td width="5%"><input type="checkbox" value="1"></td>
<td class="warning">1</td>
<td class="warning">2</td>
<td class="warning">3</td>
</tr>
<tr>
<td width="5%"><input type="checkbox" value="2"></td>
<td class="warning">4</td>
<td class="warning">5</td>
<td class="warning">6</td>
</tr>
<tr>
<td width="5%"><input type="checkbox" value="3"></td>
<td class="warning">7</td>
<td class="warning">8</td>
<td class="warning">9</td>
</tr>
</table>
/* Etc tables ... */
jQuery code:
$( document ).ready(function() {
$(".checkAll").click(function(e){
$(this).closest('tr').attr('class', 'success');
if(!this.checked){
$(this).closest('tr').attr('class', 'info');
}
$('#tetelek').find('td input:checkbox').prop('checked', this.checked);
$('#tetelek').find('td').prop('class', 'success');
});
});
I would like to create a sample invoice generator systems. If I click to checkbox id's 'checkAll', the jquery put 'selected' checkbox in id="tetelek" table. And over the click, I would like to set td class: active (from bootstrap). So, example.
Thank you!