Evgeny
Evgeny

Reputation: 193

How I get <b-form-select> element's id ( BootstrapVue) of the options changes event in Vue.js

I would like to get select's element id on v-on:change event on selected options in Vue.js

My vue code is :

  <b-form-select id="1749614592" :
  options="{'0': 'Default','1': 'Stored'}"
  v-on:change="isOnChange($event)">
  </b-form-select>

My script is :

   methods: { 
   isOnChange: function(event) {
   console.log(event.target.parentNode);   
   }
   },

Upvotes: 0

Views: 700

Answers (1)

JKL
JKL

Reputation: 1060

If I understand your question correctly you could try the following:

<b-form-select 
    id="1749614592" :
    options="{'0': 'Default','1': 'Stored'}"
    v-on:change="isOnChange($event, '1749614592')">
</b-form-select>

and as script:

methods: { 
    isOnChange: function(event, id) {
        console.log("Selected id: " + id)
    }
}

Upvotes: 2

Related Questions