I have a system that is tracking volunteers for a performing arts center. When they sign up to work a shift they can also sign up a buddy (or buddies). There’s also a waiting list if we have too many sign-ups. The form looks like so for selecting buddies:

If the waiting list only has one position left on it I need to turn the next person’s name red if they are selected (so John is selected, but when Jane is checked she turns red to serve as a warning).
My problem is that the user might decide to check them both, then uncheck John instead of Jane, which should then make Jane turn black again.
Is there an easy way to track clicks using something like:
$("input:checkbox").change(function(){
$("input:checked").each(function(i){
//object/array manipulation?
});
});
I had it working okay using the index of the element but realized that wouldn’t work since it would keep track of the order in which the checkboxes were checked in the first place.
Even a point in the right direction would be amazing. I realize I haven’t given much to go on.
Thanks,
Jason
Nice challenge. You could do this:
As you can see, it has a ‘preference’ to blacken checkboxes that have been checked first. This is not tested code, and may have errors, but i hope it guides you to your final solution