Answer the question
In order to leave comments, you need to log in
How to get data from an indefinite number of inputs?
If there is an HTML of the form
<div id = "container">
<input id = "form-input" name = "k1" type = "hidden">
<input id = "form-input" name = "k1" type = "hidden">
<input id = "form-input" name = "k1" type = "hidden">
...
<input id = "form-input" name = "k1" type = "hidden">
...
</div>
Answer the question
In order to leave comments, you need to log in
1. id
- a unique identifier, it must be in one copy.
2. In vue, an indefinite number of inputs looks something like this:
<div id="container">
<input v-for="input in inputs" v-model="input.value" :name="input.name" type="hidden" >
</div>
data: {
inputs: [
{
name: 'k1',
value: ""
},
{
name: 'k2',
value: ""
}
]
}
And the values are obtained, respectively, from the array inputs
. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question