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 Get Input Value by Id</h3> <input type="text" ref="myInput" /> <button @click="getValue()">Get Value</button> <p v-if="result">{{result}}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { result: '' } }, methods: { getValue() { this.result = this.$refs.myInput.value; } } }); </script> <style scoped> #app { font-family: Arial, sans-serif; margin: 20px; } h3 { font-size: 24px; font-weight: bold; } input { padding: 10px; border: 1px solid #ccc; border-radius: 4px; margin-right: 10px; } button { background-color: #4CAF50; color: white; padding: 10px 20px; border: none; border-radius: 4px; cursor: pointer; } p { margin-top: 10px; font-weight: bold; } </style> </body> </html>