HTML:
<select v-model="model">
<option hidden disabled v-bind:value="false" selected>Placeholder</option>
<option v-for="item in array" v-bind:value="item.id"> @{{ item.name }}</option>
</select>
I have a select much like the above and I'm using some jQuery to update the select box. I can't however seem to update the v-model to align with the jQuery change.
jQuery:
.on('mousedown', '.class', function (evt) {
evt.preventDefault();
$(this).find('option:first').prop('selected', true).val(false).change();
});
The jQuery here listens for a mousedown
event on a clear button which selects the placeholder option i.e. resetting the select box. However I was hoping .val(false).change()
would be enough to trigger the v-model to update - it was not.