I've set up an input field with a ref="inputField"
as shown below:
<input ref="inputField">
<button @click="btn">Click</button>
When the button is clicked, I want the input field to receive focus. Here's the code I'm using:
<script>
methods: {
btn() {
this.$refs.inputField.focus()
}
}
</script>
However, this method isn't working as expected.
Is there a way to make the input field focus when the button is clicked?