From 2f2db6edc6cc677db4ed45c69e3ec76ca47b04fe Mon Sep 17 00:00:00 2001 From: DarkWiiPlayer Date: Thu, 19 Dec 2024 15:44:39 +0100 Subject: [PATCH] Add support for pre-selected options --- src/BetterSelect.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BetterSelect.js b/src/BetterSelect.js index 4803564..bb566a4 100644 --- a/src/BetterSelect.js +++ b/src/BetterSelect.js @@ -298,6 +298,9 @@ export class BetterSelect extends HTMLElement { this.list.replaceChildren() for (const option of this.options) { this.list.append(f`
  • ${option.innerText}
  • `) + if (option.selected) { + this.value = option.value + } } } }