1

I have multiple checkboxes, and I want to click on one and hold shiftkey and click in another and select all checkbox within that range.

But if I hold shiftkey again and click on another checkbox the range change selecting the new ones if the range is bigger or deselecting if the range is smaller.

And if i click in one and dont press shiftkey when i click another one holding shiftkey my range will select and deselect using this as reference now.

Just like in gmail does.

I searched some answers but none of then does that exactly. They only set one checkbox for start and another to end. After that you have to deselect one per one to do that again. Or start and end in checkboxes that didnt participate from the first selection.

Anyone has some ideia how can i do that using javascript / jquery?

  • 4
    How are your check boxes arranged? Are they in a two-dimensional grid? In a single-dimensional horizontal/vertical list? How do you define a range: by the index of the checkbox in the parent? Or by their spatial arrangement? There are so many questions that need to be addressed, a sign that you are missing details in your question. It is always helpful to show us what you have tried, or at least the markup you have at hand: https://stackoverflow.com/help/how-to-ask – Terry May 15 '17 at 14:17
  • Thanks for the answers, I just started in javascript, so I don't know very much what I should I had written. But next time, I will had these tips in mind. I had tried almost every exemple in that question. But they didnt work. I kept trying and this one worked almost without any problem. So i will use this one for the moment. http://stackoverflow.com/posts/35029300/revisions – Mustang San May 16 '17 at 12:01

0 Answers0