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 Validate IFSC CODE</h3> <div id="app"> <input type="text" v-model="ifscCode" @input="checkIfscCode" /> <pre v-if="errorMessage" style="color:red">{{ errorMessage }}</pre> </div> <script type="module"> const app = Vue.createApp({ data() { return { ifscCode: 'SBIN0001882', errorMessage: '', } }, methods: { checkIfscCode() { const ifscPattern = /^[A-Z]{4}0[A-Z0-9]{6}$/; if (this.ifscCode === '') { this.errorMessage = 'Please Enter IFSC CODE'; } else if (ifscPattern.test(this.ifscCode)) { this.errorMessage = 'Valid IFSC CODE'; } else { this.errorMessage = 'Invalid IFSC CODE'; } }, }, }); 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>