element regardless which type you are using. The characters you can enter into the fields are constrained, and separators are automatically added, but no actual value checking is done. This should happens primary in “input” fields as well as in inline text wrapped with some tag. // 1 var $this = $(this); var input = $this.val(); // 2 input = input.replace(/[\W\s\._\-]+/g, ''); // 3 var split = 4; var chunk = []; for (var i = 0, len = input.length; i < len; i += split) { split = ( i >= 8 && i <= 16 ) ? Recommendation. color: a control to input a color. In general, programmer/developer should not “format” the numbers. The plugin can return formatted numbers as a string, you can set decimal, and thousands separators, and you can choose the number of decimals to show. This format is used by many APIs, including Twilio's, to ensure standardized input and global support. Well, that’s my current approach. I'm not sure how you can format input numbers while typing though - functions generally get applied to an existing value. Why not have a format attribute alongside the pattern attribute? If you want user input to be automatically typecast as a Number, you can add the number modifier to your v-model managed inputs: < input v-model.number = "age" type = "number" > This is often useful, because even with type="number", the value of HTML input elements always returns a string. HTML tag. When writing in HTML, the tag is an inline element used to create both input fields and interactive controls for web-based forms. Nested within a