I am creating frontend for my SpringBoot application. To send a Get request I need to get the value from input in my program, but have no success.
I've tried to use any king of .value, valueOf(), .toString() methods after selecting document.getElementById("name") and non of them seem to work.
// the element
<form class="pt-3">
<div class="form-group">
<label for ="name">Person ID</label>
<input
type="text"
id="name"
class="form-control is"
:class="{'is-invalid': $v.name.$error} "
@input="$v.name.$touch()"
v-model="name"
placeholder="123456"
value=""
>
<div class="invalid-feedback" v-if="!$v.name.minLength">ID must be at least 5 characters</div>
<button class="btn btn-secondary btn-lg btn-block" @click="FetchData">Найти</button>
</div>
</form>
// the function
AddPerson: function () {
var nperson = document.getElementById("name").valueOf().value.name;
console.log(nperson);
}
I need to output the text the user inputs into the name line on the page and post it to console.log().
/// Added
data() {
return {
result: '',
name: '',
seats: '',
reservation: ''
}
}