screen_rotation
Copied to Clipboard
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </head> <body> <div id="app"> <h3>Vue Js Click on Div focus to Input</h3> <div @click="focusInput"> <p>Click here to focus the input:</p> <input type="text" ref="myInput"> </div> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { result: '' } }, methods: { focusInput() { this.$refs.myInput.focus(); }, }, }); </script> <style scoped> #app { display: flex; flex-direction: column; align-items: center; justify-content: center; } h3 { font-size: 1.5rem; margin-bottom: 1rem; } label { font-size: 1.2rem; margin-bottom: 0.5rem; } input { padding: 0.5rem; font-size: 1rem; border: 2px solid #ccc; border-radius: 0.5rem; outline: none; } input:focus { border-color: #0077ff; } </style> </body> </html>