Add support for optgroup

Adds support for optgroup tags when rendering the plugin from a select
tag (there's also a bug fix on line 105)