Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7556221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:48:41+00:00 2026-05-30T11:48:41+00:00

I want to enable multiselect capabilities in a jQuery UI Selectable table by holding

  • 0

I want to enable multiselect capabilities in a jQuery UI Selectable table by holding shift.

I probably should do something like this if shift is held down on mouseclick

  • Get topmost selected element
  • Get clicked element
  • Select all elements in between

but i can’t find how to do this in a clean way…

At the moment i got this inside the selectable configuration:

start: function(e)
        {
            var oTarget = jQuery(e.target);
            if(!oTarget.is('tr')) oTarget = oTarget.parents('tr');
        }

So oTarget is the clicked element (and e.currentTarget is the whole table) but now what? How can i find which elements are already selected in a way that can tell me if the clicked element is over or below the selected ones and select everything in between?

I’ve solved it now like this, added to the selectable element:

jQuery(table).mousedown(function(e)
    {
        //Enable multiselect with shift key
        if(e.shiftKey)
        {
            var oTarget = jQuery(e.target);
            if(!oTarget.is('.ui-selectee')) oTarget = oTarget.parents('.ui-selectee');

            var iNew = jQuery(e.currentTarget).find('.ui-selectee').index(oTarget);
            var iCurrent = jQuery(e.currentTarget).find('.ui-selectee').index(jQuery(e.currentTarget).find('.ui-selected'));

            if (iCurrent < iNew) {
                iHold = iNew;
                iNew = iCurrent;
                iCurrent = iHold;
            }

            if(iNew != '-1')
            {
                jQuery(e.currentTarget).find('.ui-selected').removeClass('ui-selected');
                for (i=iNew;i<=iCurrent;i++) {
                    jQuery(e.currentTarget).find('.ui-selectee').eq(i).addClass('ui-selected');
                }
                e.stopImmediatePropagation();
                e.stopPropagation();
                e.preventDefault();
                return false;
            }
        }
    }).selectable(...)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T11:48:43+00:00Added an answer on May 30, 2026 at 11:48 am

    I wrote simple plugin for that functionality. It’s not dependent on jQuery ui Selectable plugin and as far as i know works fine with it.

    You can find plugin code and simple example here: http://jsfiddle.net/bMgpc/170/

    Going to write simple description below.

    Basic usage:

    $('ul').multiSelect();
    

    If you hold “Ctrl” or “Command Key” then you can select/unselect elements one by one.

    ul – parent that holds inner elements to be selected.

    There are number of options available:

    • keepSelection – true|false – quite an important flag. If set to true (default), then selection won’t be cleared if you click on already selected element (as it works in with multiple prop)
    • multiselect – true|false -if false you can select only one element
    • selected – ‘selected’ – class that will be added to selected element
    • filter: – ‘ > *’ – what elements are we going to select
    • unselectOn – false|’selector’ – if set then if clicked on set selector selectio would be removed
    • start: false|function – callback on start
    • stop: false|function – callback on stop
    • unselecting: false|function – callback when clicked on set “unselectOn” option

    It’s a dev version plugin, so use with care

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to enable something like a one-to-many relation between a text object and
i want to enable facebox jquery using javascript. here in normal html <a href=stairs.jpg
I want to enable 'Apply' dialog button when content of some textboxes in this
I want to enable my users to enter search queries using a URL like
I want globally enable whitespace-mode. I have tried this in my .emacs: (require 'whitespace)
I want to enable GZIP compression for my static file like css styles, javascript
I want to enable Lua-Scripting (Lua 5.1) in my Delphi application. For this purpose
I want to enable/disable clipboard in an edittext. How can I do this?
I want to enable comments (like in any regular blog) but the site is
I want to enable an user to be able to communicate with other users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.