Link to home
Start Free TrialLog in
Avatar of tarrike
tarrike

asked on

Select... tag

I have a select tag with more than 200 options.  I allow the user to select multiple options, but I want to limit them to 8.  Is there any code samples to do this?
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

You could eliminate some of the options after they select them, but there is no way to limit the number they can select.

Cd&
Avatar of TallerMike
TallerMike

Add a onchange function to the select. This function should count the number of options that are selected, and alert the user if they have selected more than the desired number, also unselecting the last item selected.

Of course you'll need to store the indexes of the last set of selected items so that you can revert back to this if they select more than the max.

-Mike
Or perhaps return false if the select more than the max?
ASKER CERTIFIED SOLUTION
Avatar of TallerMike
TallerMike

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tarrike

ASKER

Thanks!  That worked perfectly