Matthias Scharwies: Lesetipp: How should <selectedoption> work?

Beitrag lesen

Guten Morgen,

How should <selectedoption> work? von Jake Archibald, 18.10.2024

We're finally getting a way to fully style & customise <select> elements! But there's a detail I'd like everyone's opinion on.

<selectedoption> automatically displays the currently selected <option> within the <button> that opens the popover menu.

It's entirely optional, so if you wanted to manually update the content of the <button> when the selected <option> changes, you can, and you get a lot more control that way. But <selectedoption> is much easier, and works without JavaScript.

When the selected <option> changes, it clears the contents of the <selectedoption>, takes a clone of the contents of the newly selected <option>, and inserts it into the <selectedoption>.

This is kinda new and weird behaviour.

Bitte lest den ganzen Artikel - er findet's dann doch nicht so shclimm!

Herzliche Grüße

Matthias Scharwies

--
Was ist eine Signatur?