Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Got this solution from <a href="http://abcoder.com/javascript/jquery/simple-check-uncheck-all-jquery-function/" rel="nofollow noreferrer">http://abcoder.com/javascript/jquery/simple-check-uncheck-all-jquery-function/</a> <strong>(now dead)</strong>:</p> <p><strong>JavaScript and HTML code</strong></p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var NUM_BOXES = 10; // last checkbox the user clicked var last = -1; function check(event) { // in IE, the event object is a property of the window object // in Mozilla, event object is passed to event handlers as a parameter if (!event) { event = window.event } var num = parseInt(/box\[(\d+)\]/.exec(this.name)[1]); if (event.shiftKey &amp;&amp; last != -1) { var di = num &gt; last ? 1 : -1; for (var i = last; i != num; i += di) { document.forms.boxes['box[' + i + ']'].checked = true; } } last = num; } function init() { for (var i = 0; i &lt; NUM_BOXES; i++) { document.forms.boxes['box[' + i + ']'].onclick = check; } }</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body onload="init()"&gt; &lt;form name="boxes"&gt; &lt;input name="box[0]" type="checkbox"&gt; &lt;input name="box[1]" type="checkbox"&gt; &lt;input name="box[2]" type="checkbox"&gt; &lt;input name="box[3]" type="checkbox"&gt; &lt;input name="box[4]" type="checkbox"&gt; &lt;input name="box[5]" type="checkbox"&gt; &lt;input name="box[6]" type="checkbox"&gt; &lt;input name="box[7]" type="checkbox"&gt; &lt;input name="box[8]" type="checkbox"&gt; &lt;input name="box[9]" type="checkbox"&gt; &lt;/form&gt;&lt;/body&gt;</code></pre> </div> </div> </p>
    singulars
    1. This table or related slice is empty.
    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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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