I want to allow user to select range of items in my unordered list by allowing him to press cntrl key and then select first & last item, all items in between would be selected. I'm using JQuery, Any suggestion how to approach this problem? Here is html:
<ul id="ulList_1">
<li>
<a href="#">item 1</a>
</li>
<li>
<a href="#">item 2</a>
</li>
<li>
<a href="#">item 3</a>
</li>
<li>
<a href="#">item 4</a>
</li>
<li>
<a href="#">item 5</a>
</li>
<li>
<a href="#">item 6</a>
</li>
<li>
<a href="#">item 7</a>
</li>
</ul>
So if user press cntrl key and select "item 2" and then select "item 6" I want all items between "items 3,4,5" to be selected as well. Thanks
Here's a jQuery plugin that allows range selection (by holding shift key):
It could easily be changed to work with LI elements and add a class based on users selection.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.