I am facing an issue with my code in Vue.js. I am having trouble retrieving the value from an input field. Below is the code snippet that I am struggling with:
HTML Codes:
<div id="app">
<div class="form-group">
<input type="text" class="form-control" name="name" value="lorem" v-model="name"/>
</div>
<button class="btn btn-primary btn-block" v-on:click="sendData()">SIGN UP</button>
</div>
Vue.js codes:
<script>
var app = new Vue({
el: "#app",
data() {
errors :{}
return {
input: {
name: "",
},
}
},
methods: {
sendData() {
alert(this.name);
}
}
})
Any help or suggestions would be greatly appreciated. Thank you!