L
L
lookingfor22019-11-11 10:39:09
JavaScript
lookingfor2, 2019-11-11 10:39:09

How to pass values ​​from selected div to input?

I have a table
5dc90f5a966bc984466026.jpeg
when clicking on TR (on the whole row), the first TD (first cell) should be transferred to the form below in the input, so that it is clear what the buyer has chosen, when clicked again, it should be deleted from the inputa
How to implement ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Koltunov, 2019-11-11
@lookingfor2

If the table is generated by a loop through v-for, then add something like this:
And then add a handler method:

selectRow(item) {
if (item.first === this.myInput) {
this.myInput = ''
} else { this.myInput = item.first }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question