I have a select box in which i can select multiple options. In the select box are multiple optgroups.
Is there an easy way to select a whole optgroup at once in javascript?
I'm normally against using jQuery for simple jobs like this but I can see its value here. Still, if you prefer a non-jQuery solution that will have the benefits of using no library, introducing no spurious ids or classes and running faster, here is one: