Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>&lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { $("#colorall").click(function() { var checked_status = this.checked; $(".color").each(function() { this.checked = checked_status; }); }); $(".color").click(function(){ if($(".color").length == $(".color:checked").length) { document.getElementById("colorall").checked = true; } else { $("#colorall").removeAttr("checked"); } }); $("#brandall").click(function() { var checked_status = this.checked; $(".brand").each(function() { this.checked = checked_status; }); }); $(".brand").click(function(){ if($(".brand").length == $(".brand:checked").length) { document.getElementById("brandall").checked = true; } else { $("#brandall").removeAttr("checked"); } }); }); &lt;/script&gt; &lt;form action="&lt;?php $_SERVER['PHP_SELF']?&gt;" method="post"&gt; &lt;input type="checkbox" id="colorall" /&gt; Select All colors&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="color[]" value="yellow" class="color"&gt; Yellow&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="color[]" value="blue" class="color"&gt; Blue&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="color[]" value="red" class="color"&gt; Red&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="color[]" value="green" class="color"&gt; Green&lt;/label&gt;&lt;br/&gt;&lt;br/&gt; &lt;input type="checkbox" id="brandall"/&gt; Select All brands&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="brand[]" value="Nike" class="brand"&gt; Nike&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="brand[]" value="Adidas" class="brand"&gt; Adidas&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="brand[]" value="SomeBrand" class="brand"&gt; SomeBrand&lt;/label&gt;&lt;br/&gt; &lt;label&gt; &lt;input type="checkbox" name="brand[]" value="SomeOtherBrand" class="brand"&gt; SomeOtherBrand&lt;/label&gt;&lt;br/&gt; &lt;/form&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload