|
multi select checkboxes.
Hi, i'm looking to make a JS that will let users select multiple checkboxes. I want to be able to hold down shift, click a checkbox, hold shift again, click another checkbox, and then, all the checkboxes between the two that i clicked should be checked. Can someone help me out with the script for that? I would really appreciate it.
I'm sure this shouldn't be too hard to whip up in JS.
1. Make sure each input field is <input type="checkbox" order="1" ...>,
where order is sequential from 1 down the page
2. Add JS so on each 'onclick', it keeps track of 'order' item of the last
clicked checkbox
3. If the click has shift held down, make sure you check/uncheck everything
between the last clicked on checkbox (as saved in step 2) and the current
checkbox. Since they're sequential, easy to do, just count up or down
towards the current one.
Keith
|