moses toh
moses toh

Reputation: 13162

How to display the value of select option on value input text ? (vue.js 2)

My code is like this :

<div id="demo">
  <div>
    <select class="form-control" v-model="selected" required>
      <option v-for="option in options" v-bind:value="option.id">{{ option.name }}</option>
    </select>
    {{selected}}
  </div>
</div>

<input type="text" :name="elementName" v-model="{{selected}}">

See full code here : https://fiddle.jshell.net/stvct9er/1/

After select on combo box, I want to display value of select option on the input text

I try like above code. But it does not work

Please, help me to solve my problem

Upvotes: 0

Views: 1555

Answers (1)

ABDEL-RHMAN
ABDEL-RHMAN

Reputation: 3014

You need to move the input inside the demo div because this is the mounted point ,

and with v-model just use quotes <input type="text" v-model="selected">

https://fiddle.jshell.net/stvct9er/2/

Upvotes: 2

Related Questions