posted 17 years ago
Greetings,
I have a bunch of checkboxes, and I have an alert that informs the user when he has selected the maximum number of selections. So say my maximum is six: once the user clicks on his sixth checkbox, the alert appears.
What I'm trying to do is to prevent the user from selecting a seventh checkbox unless he deselects one of the six already selected. I can retrieve all the checkbox elements as one array and access each checkbox via its index, but how can I reliably retrieve the index of the most recently selected checkbox (i.e., the index of the seventh checkbox so I can set its "checked" attribute to "false")?