I have a numeric textbox as follows:
<numeric-textbox id="value-field" :default-value="0.00" :min="0.00" :format="'n2'" :spinners="false" @change="amountChanged($event)" :disabled="amountDisabled" />
How can I set the value in code?
The things I've tried:
$('#value-field').val(0.00);- this works temporarily but changes back to the previous value when it gets the focusI tried a model like
v-model="myValue"but changing the value in code doesn't update the field.
I can't figure out what I need to do to get it to change!
You should use
v-modeldirective shorthand or:valuebind and@inputevent. (vue docs)FULL DEMO: https://stackblitz.com/edit/gzbkbk-maqc4a?file=src/main.vue
v-model::valueand@input: