I am attempting to trigger a function when a button is clicked.
Furthermore, the value from the text box one
should be displayed in a div
.
Sample code:
<input v-model="textdata" type="text" class="w-full rounded">
<div class="bg-white h-10 w-full">{{textdata}}</div>
<button @click="getvalue" class="bg-green-800 rounded">RECEIVE</button>
Vue.js:
<script>
import { defineComponent } from 'vue'
export default defineComponent({
setup() {
function getvalue(){
console.log(this.textdata)
}
return{
getvalue,
}
}
})
</script>
Currently, the data is being displayed in the console, but the goal is to show the same data in the div element.