Discussion icon indicating copy to clipboard operation
Discussion copied to clipboard

Fetch the value of element dynamically

Open mihirpatelipsos opened this issue 7 years ago • 0 comments

Hello,

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?

Thanks, Mihir

mihirpatelipsos avatar Mar 11 '18 17:03 mihirpatelipsos