not showing all checkedbox function
Hi
I have a table with checkboxes, there are 3rows (including heading) & 4 columns (including checkbox). when I checked the checkbox for a row, then it will show the dropdown list, else the dropdown list will be invisible. this works fine for me for each of them but when I try to "select all checkbox" from the top, it select all the checkboxes but does not show dropdown list.
function valueChanged()
{
if($(".checkezspeedkit").is(":checked"))
$(".qtyezspeedkit ").show();
else
$(".qtyezspeedkit").hide();
}
function valueChanged2()
{
if($(".checkezenergykit").is(":checked"))
$(".qtyezenergykit").show();
else
$(".qtyezenergykit").hide();
}
function toggle(source) {
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i] != source)
checkboxes[i].checked = source.checked;
}
}
- <table id="mytable" class="table table-bordred table-striped">
- <thead>
- <th><input type="checkbox" id="checkall" class="checkall" onclick="toggle(this);"/></th>
- <th>Name</th>
- <th>Qty</th>
- <th>Option</th>
- </thead>
- <tbody>
- <tr>
- <td><input type="checkbox" class="checkezspeedkit checkboxitem" name="chkezspeedkit" onchange="valueChanged()"/></td>
- <td>EZSpeed Kit</td>
- <td>
- <select name="Select1" style="width: 50px" class="qtyezspeedkit" >
- <option>1</option>
- <option>2</option>
- </select>
- </td>
- <td>
- <select name="Select2" style="width: 137px" class="qtyezspeedkit">
- <option>Please select</option>
- <option>Required</option>
- <option>Option</option>
- </select>
- </td>
- </tr>
- <tr>
- <td><input type="checkbox" class="checkezenergykit checkboxitem" name="chkezspeedkitbluetooth" onchange="valueChanged2()"/></td>
- <td>EZEnergy Kit</td>
- <td>
- <select name="Select1" style="width: 50px" class="qtyezenergykit" >
- <option>1</option>
- <option>2</option>
- </select>
- </td>
- <td>
- <select name="Select2" style="width: 137px" class="qtyezenergykit" >
- <option>Please select</option>
- <option>Required</option>
- <option>Option</option>
- </select>
- </td>
- </tr>
- </tbody>
- </table>
thank you