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 Remove Special Character from String</h3> <input type="text" v-model="myString" placeholder="Enter a string"> <p>{{ updatedString }}</p> </div> <script type="module"> const app = new Vue({ el: "#app", data() { return { myString: 'font-awesome-icons', } }, computed: { updatedString() { // remove special characters using regular expressions return this.myString.replace(/[^a-zA-Z0-9]/g, ''); } } }) </script> <style> #app { margin: 0 auto; max-width: 600px; padding: 20px; background-color: #f0f0f0; border-radius: 5px; } h3 { font-size: 24px; margin-bottom: 10px; } input[type="text"] { font-size: 16px; padding: 10px; border: 1px solid #ccc; border-radius: 5px; width: 100%; margin-bottom: 20px; } p { font-size: 18px; font-weight: bold; color: #333; } </style> </body> </html>