How to get IDs of selected options when using bootsrap-select and multiple?

I’m using bootsrap-select.

I have 3 dropdowns. I need to filter the options (hide them) of descendant dropdowns based on the selected options in the parent dropdown.

For that I added IDs and classes to each option. So the class represent the ID of the parent option.

<select id="parent">
    <option id="parent_id_1"></option>
</select>

<select id="child_1">
    <option id="child_id_1" class="parent_id_1"></option>
<option id="child_id_2" class="parent_id_1"></option>
</select>

I need to get the IDs of the selected options, and then iterate each of them to hide any option that does not have their class that corresponds to their IDs.

But bootsrap-select wraps everything in other elements so I just couldn’t find a way to do it