0

I am using one div formed of a table where I used a checkbox for parent and child checkbox. I need here when I click parent checkbox all the child checkbox should get disabled and if uncheck parent checkbox all the child checkboxes should get unchecked.

Below is the code used to show a checkbox in Div.

<div class="dxqb-tableFields-wrapper">
<div class="dxqb-table-field-checkbox dx-widget dx-checkbox dx-checkbox-checked" data-bind="dxCheckBox: { value: selectedWrapper }, click: function(surface, e) { surface.toggleSelected(); e.stopPropagation(); return true;  }" tabindex="0" role="checkbox" onclick="void(0)" aria-checked="true">

<input type="hidden" name="" value="true">
  <div class="dx-checkbox-container">
    <span class="dx-checkbox-icon"></span>
  </div>
</div>

<div class="dxqb-table-field-checkbox dx-widget dx-checkbox" data-bind="dxCheckBox: { value: selectedWrapper }, click: function(surface, e) { surface.toggleSelected(); e.stopPropagation(); return true;  }" tabindex="0" role="checkbox" onclick="void(0)" aria-checked="false">
  <input type="hidden" name="" value="false">
  <div class="dx-checkbox-container">
    <span class="dx-checkbox-icon"></span>
  </div>
</div>
</div>

for time being I used two checkboxes one is parent another is the child. We can see the first checkbox having hidden field having value true means that checkbox is checked and another one is unchecked so hidden field value is false.

How can I achieve the same using jquery?

Vijayanath Viswanathan
  • 8,027
  • 3
  • 25
  • 43
V.Prasad
  • 131
  • 4
  • 19
  • 1
    Please provide a code sample that reproduces the problem. Your current sample doesn't. – Angelos Chalaris Oct 09 '17 at 08:34
  • 1
    Does this answer your question? https://stackoverflow.com/questions/2228382/select-all-checkboxes-with-jquery – Calaris Oct 09 '17 at 08:37
  • 1
    Possible duplicate of [Select all checkboxes with jQuery](https://stackoverflow.com/questions/2228382/select-all-checkboxes-with-jquery) – Dmitry Oct 09 '17 at 08:44
  • Hi, My problem is here the code i provided there, I don't have any checkbox instead i have hidden field using this i wanted to know which checkbox is clicked parent or child based on that i will enable and disable child checkboxes.I need here to find first hidden field and based on that create event of it like change or click event so then user click on parent checkbox based on it other checkboxes will take in one loop and make them disabled, And if any child checkbox is checked then parent checkbox should be disabled. Hope you can understand the situation now. – V.Prasad Oct 09 '17 at 08:47
  • can u clarify how to differentiate between child and parent ? – krishnar Oct 09 '17 at 08:55

0 Answers0