Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我做了一个简单的登录表单,但客户想输入一个 24 个字符的密码。奇怪的是,HTML5 的表单验证器似乎在 16 处阻止了它,这真的很烦人。我尝试了模式,但没有奏效。有任何想法吗?
<input type="password" id="password" name="password" pattern=".{5,25}" required />
所以我想将其限制为 24 个字符而不是默认的 16 个字符。
在此先感谢您的帮助。
添加maxlength="24"到您的属性
maxlength="24"
IE
<input type="password" id="password" name="password" maxlength="24" required="true" />