[Vuejs]-How to pass date-picler tag to input type hidden?

1👍

You don’t need a watcher or any DOM manipulation to do this. The power of Vue is being able to 1-way or 2-way bind data variables to input elements. See the official Vue documentation on Form Input Bindings, it’s very helpful to understand. If the date-picker value is bound to the date variable, you can bind date to your other input as well.

<input type="text" name="inputDate" id="inputDate" :value="date" />

Using :value creates a 1-way binding. This makes it so the <input> will always reflect the latest value of <date-picker> but not vice versa.

working sandbox example

👤yoduh

Leave a comment