Sort dropdown list and optgroup

Sort dropdown list and optgroup

Hello,

First off, what is the proper way to use optgroups?

<optgroup label="XYZ" />

or
<optgroup label="XYZ">
</optgroup>


I have noticed that when I use
$('#mylist').append('</optgroup>');

in Opera, it never gets appended, but in IE it does. How come?

Anyway to my main question, if I've got a drop down list and multiple optgroups in that list, how can I sort each group separately? And is it possible to add an item into a certain group directly?

Thanks