S
SolidJS6mo ago
Liquido

How to make range input element reactive

const [step, setStep] = createSignal(0.01);

<div>
<label for="step">Step</label>
<input
id="step"
type="range"
min={0.01}
max={1.0}
value={step()}
onInput={(e) => {
console.log(e.currentTarget.value);
setStep(parseFloat(e.currentTarget.value));
}}
/>
{step()}
</div>
const [step, setStep] = createSignal(0.01);

<div>
<label for="step">Step</label>
<input
id="step"
type="range"
min={0.01}
max={1.0}
value={step()}
onInput={(e) => {
console.log(e.currentTarget.value);
setStep(parseFloat(e.currentTarget.value));
}}
/>
{step()}
</div>
How do I make this work?
2 Replies
REEEEE
REEEEE6mo ago
What doesn't work?
Liquido
LiquidoOP6mo ago
Nevermind, I forgot to set the step property :/
Want results from more Discord servers?
Add your server