svelte-select
svelte-select copied to clipboard
Unable to get the value of svelte-select
I used svelte-select as select plugin
This is a simplified example
The input component input can get the value
The value cannot be obtained after the select component is selected
<script>
import Select from "[email protected]";
import { useForm } from "[email protected]";
const form = useForm();
let collection = [
{ value: 1, label: "one" },
{ value: 2, label: "two" },
{ value: 3, label: "three" }
];
</script>
<form use:form>
<input name="test" >
<Select name="select" items={collection} />
</form>
<pre>
{JSON.stringify($form, null, " ")}
</pre>
@ljm000 Do you mean, if you use document.querySelector to get the svelte select component, you cannot retrieve the value from it?
You can add a input hidden with value={justValue} and set the select with bind:justvalue