Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1008423 // hCheckBoxMultiSelect - requires checkboxes to have class .chkbox

JavaX fragment (include)

static S hCheckBoxMultiSelect() {
  ret hscript([[
var lastChecked = null;

$(document).ready(function() {
    var $chkboxes = $('.chkbox');
    $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;
    });
});]]);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008423
Snippet name: hCheckBoxMultiSelect - requires checkboxes to have class .chkbox
Eternal ID of this version: #1008423/3
Text MD5: 27f737fdc89e34b4e16a5e01c0d0481e
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-11-17 13:54:30
Source code size: 581 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 533 / 553
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1030223 - hCheckBoxMultiSelect_v2 - works with all checkboxes that have a class