datepicker
datepicker copied to clipboard
How to clear the input programmatically
Hi,
First, thank you for that awesome component! Works like a charm!
I am looking for a simple way to clear the input programmatically without the use of the data-clear
button?
I use the <datepicker>
component in the template of another component. I would like to be able to clear the input of the datepicker within a @submit
event from the parent form.
Thank you for your help. Regards, Clément
Assuming you're using the v-model
binding you can simply set the value of your data property to null
. That should clear the input field.
I indeed use the v-model
binding and set the value to empty as you can see here: MenergyForm.vue. Although this doesn't work. I tried setting it to null
but same.
Thank you for your help.
Hmm, so while the underlying value is changed the actual input isn't cleared. I've submitted a pull request here: #69
Btw I don't believe your @input="setDate"
binding is necessary.
Thank you. Waiting for the #55 to be merged. I also think your approach is better but we will see :)
I also have the same issue. Setting the bound to variable's value to "" or null does not clear the input.