I have 2 inputs and want switch focus from first to second when user press Enter. I tried mix jQuery with Vue becouse I can't find any function to focus on something in Vue documentation:
<input v-on:keyup.enter="$(':focus').next('input').focus()"
...>
<input ...>
But on enter I see error in console:
build.js:11079 [Vue warn]: Property or method "$" is not defined on the instance but referenced during render. Make sure to declare reactive data properties in the data option. (found in anonymous component - use the "name" option for better debugging messages.)warn @ build.js:11079has @ build.js:9011keyup @ build.js:15333(anonymous function) @ build.js:10111
build.js:15333 Uncaught TypeError: $ is not a function
v-on:keyup.enter="this.nextSibling.focus()"
– Raphaelbuild.js:15333 Uncaught TypeError: Cannot read property 'focus' of undefined
– Dexamethasone<input id="XX" ...>
. Try to add one and change this linev-on:keyup.enter="document.getElementById('XX').focus()"
– Raphaeldocument.getElementById('next_id').focus();
but it again givesbuild.js:11079 [Vue warn]: Property or method "getElementById" is not defined on the instance but referenced during render
. – Dexamethasone