views:

68

answers:

1

Hi, 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

+1  A: 

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.

duckyflip
thanks, I'll see to change this to work with list li elemnts
krul