Rendering <input>s in <For>

How can I reference a dynamic number of <input>s to read their value? Thanks.
2 Replies
TaQuanMinhLong
how about get the ref of their wrapper and look for child refs to get all the values of the inputs? or you can just store everything in a store
const [refs, setRefs] = createStore([]);

<For each={inputs}>
{(input, idx) =>
<input ref={(ref) => setRefs(idx, ref)} />
}
</For>
const [refs, setRefs] = createStore([]);

<For each={inputs}>
{(input, idx) =>
<input ref={(ref) => setRefs(idx, ref)} />
}
</For>
deluksic
deluksic3d ago
You can also subscribe to form submit where you get the FormData object This is useful when you want enter to submit behavior for example
Want results from more Discord servers?
Add your server