I have a select option html, i need to hide one of the options only with css without changing the html structure like adding more class or id.
here's the html structure:
<select id="net_terms_id" name="order[account][net_terms_id]" class="select admin__control-select">
<option value>-Select Net Term-</option>
<option value="Devtest">Devtest</option>
<option value="15 Days Net">15 Days Net</option>
</select>
here's what i've done so far with the css:
#net_terms_id option:empty {display: none;}
#net_terms_id option[value=""] {display: none;}
If you want to hide the empty option with just css you can try adding selected disabled hidden style='display: none' and that should do the trick.
<select id="net_terms_id" name="order[account][net_terms_id]" class="select admin__control-select">
<option value selected disabled hidden style='display: none'>-Select Net Term-</option>
<option value="Devtest">Devtest</option>
<option value="15 Days Net">15 Days Net</option>
</select>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With