<p>This is probably a really simple jQuery question, but I couldn't answer it after 10 minutes in the documentation so...</p>

<p>I have a list of checkboxes, and I can get them with the selector <code>'input[type=checkbox]'</code>. I want the user to be able to shift-click and select a range of checkboxes. To accomplish this, I need to get the index of a checkbox in the list, so I can pass that index to <code>.slice(start, end)</code>. How do I get the index when the user clicks a box?</p>

The following selector should also work in jQuery:
```
input:checkbox
```
.
You can then string the
```
:gt(index)
```
and
```
:lt(index)
```
filters together, so if you want the 5th to 7th checkboxes, you'd use
```
input:checkbox:gt(4):lt(2)
```
.
To get the index of the currently clicked checkbox, just use
```
$("input:checkbox").index($(this))
```
.