Fetch the value of element dynamically in Vuejs

Ask A Question

Login To post a question

I’m not sure if this is the question directly relate to Vue or JavaScript, but as it involves ‘refs’ from VueJs, i have posted question here.

I’ve multiple input text elements in my DOM. They are named as txtScore1, txtScore2, txtScore3 etc. On my click button event I want to fetch the value from say txtScore1. But how can I pass this refernce dynamically in this.$refs.{{ #some way of referring txtScore1 dynamically# }}.value?

I’m creating input element as follows:
<input v-bind:ref="'txtScore' + props.item.Id" type="text"/>

can you please help?


For more info please click herehttps://stackoverflow.com/q/49223124

Have a question or need a custom quote?