jQuery -Select all checkboxes for each dynamic tables by norlihazmey ghazali

http://stackoverflow.com/questions/35987810/select-all-checkboxes-for-each-dynamic-tables/35987996#35987996

HTML

<table width="800" border="1" cellpadding="2" cellspacing="0" class="inlineTable" style="border-collapse: collapse" bordercolor="#000000">
    <tr>
        <th>Sl No</th>
        <th width=130>Tender Description</th>
        <th>Main</th>
        <th>
            <input type="checkbox" class="selectAll" />
        </th>
        <th title="Selected to Quotation">S2Q</th>
    </tr>
    <tr align='center'>
        <td>1</td>
        <td width='140'>Silicon Free Tape </td>
        <td></td>
        <td>
            <div class='list-item'>
                <input class='checkbox1' type='checkbox' name='member[1]' value='53'>
            </div>
        </td>
        <td title='Selected to Quotation' class="dark">
            <input type="checkbox" disabled="disabled" name="comparitive[]" value="53" checked='checked' />
        </td>
    </tr>
    <tr align='center'>
        <td>2</td>
        <td width='140'>UV Sensitive Tape</td>
        <td></td>
        <td>
            <div class='list-item'>
                <input class='checkbox1' type='checkbox' name='member[2]' value='54'>
            </div>
        </td>
        <td title='Selected to Quotation' class="dark">
            <input type="checkbox" disabled="disabled" name="comparitive[]" value="54" checked='checked' />
        </td>
    </tr>
</table>

<table width="800" border="1" cellpadding="2" cellspacing="0" class="inlineTable" style="border-collapse: collapse" bordercolor="#000000">
    <tr>
        <td colspan="6" align="center" width="800"><strong>Trend Zone limited&nbsp;(USD)</strong></td>
    </tr>
    <tr>
        <th>Sl No</th>
        <th width=130>Tender Description</th>
        <th>Tech %</th>
        <th>Main</th>
        <th>
            <input type="checkbox" class="selectAll" />
        </th>
        <th title="Selected to Quotation">S2Q</th>
    </tr>
    <tr align='center'>
        <td>1</td>
        <td width='140'>Silicon Free Tape </td>
        <td></td>
        <td></td>
        <td>
      ...

JavaScript

$(document).on('click','.selectAll', function(e){
  var table= $( this ).closest('table');
  table.find(':checkbox').not( this ).prop('checked',this.checked);
});