Quantcast
Channel: Active questions tagged svelte - Stack Overflow
Viewing all articles
Browse latest Browse all 1541

Why value property on input element on svelte is not working?

$
0
0

I want to manage the value of a state (to make custom validations, so I won't use bind:value) to pass into my input, but the value displayed in the input is not the value I have in the a state, why happend that?

enter image description here

<script lang="ts">  let a = "";  const onChange = (e: any) => {    const nv = e.target.value;    if (nv.length <= 4) {      a = nv;    }  };</script><div>value:{a}</div><input type="text" value={a} on:input={onChange} />

Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>