How to hide optgroup/option elements?

I figured that this solution works fine for me:

Make another select e.g.

$("#footer_canvas").after('<select id="parkingLot"></select>');

then hide it

$("#parkingLot").hide();

When you want to 'hide' some optgroup, just 'park' it in this hidden select.

$('#VehicleVehicleCategoryId optgroup[label="kategorie L"]').appendTo("#parkingLot");

Same way you can make it visible. This is just the snippets of my solution, that works fine for me.