Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I wrote a self-contained demo that uses jquery:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).ready(function() { var $chkboxes = $('.chkbox'); var lastChecked = null; $chkboxes.click(function(e) { if(!lastChecked) { lastChecked = this; return; } if(e.shiftKey) { var start = $chkboxes.index(this); var end = $chkboxes.index(lastChecked); $chkboxes.slice(Math.min(start,end), Math.max(start,end)+ 1).prop('checked', lastChecked.checked); } lastChecked = this; }); });</code></pre> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="checkbox" id="id_chk1" class="chkbox" value="1" /&gt;Check 1&lt;br/&gt; &lt;input type="checkbox" id="id_chk2" class="chkbox" value="2" /&gt;Check 2&lt;br/&gt; &lt;input type="checkbox" id="id_chk3" class="chkbox" value="3" /&gt;Check 3&lt;br/&gt; &lt;input type="checkbox" id="id_chk4" class="chkbox" value="4" /&gt;Check 4&lt;br/&gt; &lt;input type="checkbox" id="id_chk5" class="chkbox" value="5" /&gt;Check 5&lt;br/&gt; &lt;input type="checkbox" id="id_chk6" class="chkbox" value="6" /&gt;Check 6&lt;br/&gt; &lt;input type="checkbox" id="id_chk7" class="chkbox" value="7" /&gt;Check 7&lt;br/&gt; &lt;/body&gt; &lt;/html&gt;</code></pre> </div> </div> </p>
 

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