Maxlength attribute not working in number input type (Chrome)

 


The maxlength attribute is not working with <input type="number">. This happens only in Chrome.


Solution:


<input onkeypress="if(this.value.length==6) return false;" type="number" />


Demo:

https://stackblitz.com/edit/typescript-cwc9ge?file=index.ts

Comments

Popular posts from this blog

SwiftUI - Tutorial 2 - 🧵 Understanding @MainActor in SwiftUI — A Beginner’s Guide

SonarQube With Angular 19 on Windows: A Complete Setup and Integration Guide

Setting Up Jenkins for Flutter App on macOS