Get the value of the text box based on its id VUEjs method
P粉002023326
P粉002023326 2024-03-26 15:07:28
0
2
354

I have two text boxes, both text boxes have values.

But I want to get the value of a text box based on the id number I want to enter.

If I enter 1 it should show the value of textbox 1.

This is what I tried and now it shows the data in both text boxes.

template:

<input  v-model="textdata1" id="1" type="text" placeholder="i am id1, show my value">

<input v-model="textdata2" id="2" type="text" placeholder="i am id2, show my value">

<input v-model="searchid"  type="text" placeholder="which ids data you want, 1 or 2 ">

<button  @click="getvalue">RECEIVE</button>

<div>show value of id 1or2 here: {{id1data}}</div>

VUEJS:

rrr
P粉002023326
P粉002023326

reply all(2)
P粉706038741

This is one method. You can create a pair of data values ​​for each input.

sssccc



For brevity and organization, you can also use reactive() purpose.

P粉176151589

If you insist on using ID, you can use the following method:

sssccc



Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!