bart
164
2
Vue

VueJS selectize input model binding

Posted 2 years ago by bart

Hey everybody,

I have something like this:

<select v-model="selection" class="selectize" multiple>
...
</select>

<button type="button" v-on:click="checkMe">Yeah, check me</button>

new Vue({
    el: '#app',

    data: {
        selection: ''
    },

    methods: {
        checkMe() {
             console.log(this.selection)
        }
    }
}

I expected an array of selected items here but I'm getting the empty string logged to console. Do you have any idea what I can do here? I think the problem is, that selectize (http://selectize.github.io/selectize.js) won't update the "ghost" element, but some child elements it creates on the fly, right?

Thanks a lot!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.