screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script> </head> <body> <h3>Vue js aadhar masking</h3> <div id="app"> <input type="text" v-model="adharNumber" @input="maskedAdharNumber"> </div> <script type="module"> const app = Vue.createApp({ data() { return { adharNumber: '' } }, methods: { maskedAdharNumber() { this.adharNumber = this.adharNumber.replace(/\D/g, '').substring(0, 12); // Remove all non-numeric characters and limit to 12 digits if (this.adharNumber.length > 0) { this.adharNumber = this.adharNumber.match(/.{1,4}/g).join(' '); // Add a space after every 4 characters } } } }); app.mount('#app'); </script> <style scoped> input { height: 40px; text-align: center; font-size: 24px; margin: 0; padding-left: 0; border: none; border-bottom: 2px solid #ccc; box-shadow: none; background-color: transparent; color: #333; transition: all 0.3s ease-in-out; font-family: Arial, Helvetica, sans-serif; } input:focus { outline: none; border-bottom-color: #007bff; } </style> </body> </html>