javascript - Selecting range of items in unordered list -
I allow the user to select the category of items in my unordered list by pressing the cntrl key and then the first & Amp; ; The last item, all the items will be selected in the middle. I am using JQuery, any suggestions how to deal with this problem? Here is the html:
& lt; Ul id = "ulList_1" & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 2 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 3 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 4 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 5 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 6 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" & gt; Item 7 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt;
If the user presses the cntrl key and select "item 2" and then select "item 6" then i select all items between "item 3,4,5"
which allows limit selection (by taking the change key):
It can be easily changed to work with AI elements and to add a class based on user selection.
Comments
Post a Comment