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

Your build is currently configured to use incompatible Java 21.0.3 and Gradle 8.2.1. Cannot sync the project.

Google Assistant Implementation in Android application with app actions