Get selectedOptions on sl-select with Shoelace.style

511 Views Asked by At

I have an <sl-select> element from Shoelace.style.

I have selected it in my script but unlike the native <select>, it doesn't appear to have a selectedOptions property.

Is there an alternative? or how can I get selectedOptions from it?

What options do I have here?

1

There are 1 best solutions below

0
Nick Cipriani On

You can achieve the same thing by checking the value attribute on the sl-select component.

Here is a demo of it working.