Reputation: 83
How do I change selected options from the outside?
I have a multiple select and the user can click on the "All" button to select all the options.
I've tried to use the jQuery function "prop", but it only works visually; it doesn't change the Vue data.
$('option', '#filter-accountexpl').prop('selected', true);
Upvotes: 0
Views: 632
Reputation: 82459
Stop using jQuery to do this.
You can select all of your options this way.
this.vaccountsexpl = Object.keys(this.accountsexpl)
You can select none of your options this way.
this.vaccountsexpl = []
You can select any list of your options this way.
this.vaccountsexpl = [129,132,133]
Here is your fiddle updated.
Vue is driven by data.
Upvotes: 1