Skip to content

Selected attribute being removed from <option> in <select> element #6701

Discussion options

You must be logged in to vote

It's being set as a property on the element which works quite the same - but the browser doesn't reflect that as an attribute. If you need an attribute, use the .attr modifier.

https://vuejs.org/api/built-in-directives.html#v-bind

<template>
      <select id="test" name="test" multiple tabindex="-1">
            <option
                v-for="(msg, index) in msgs"
                :key="index"
                :value="msg"
                :selected.attr="'selected'"
            >

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MichaelHeydon
Comment options

Answer selected by MichaelHeydon
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants