[Vuejs]-Convert dropdown to text box when other option is selected

0👍

Simple job for v-if and v-else. Display the multiselect while the selection value is not "Other", else display the textbox. A very simple implementation would look like this:

<multiselect 
  v-if="form.task_name !== 'Other'"
  v-model="form.task_name"
  :options="taskNameChoices"
>
<input v-else>

The <input> field would need it’s own v-model but how exactly to hook it up is an implementation detail that’s up to you.

Leave a comment