Skip to content
Wepress
Main Navigation
Home
Examples
基础
HTML
CSS
JavaScript
编程
前端安全
场景题
工程化
性能优化
编程题
跨端技术
框架
Node
React
TypeScript
Vue
小程序
计算机网络
其他
AI相关
leetcode
工具
算法
计算机基础
趣味题
选择题
Appearance
Menu
Return to top
On this page
如何控制 input 输入框的输入字数?
参考答案:
一般是通过 maxlength 属性进行限制:
js
<
input
maxlength
=
"5"
/>
另外还可以通过监听
οninput
事件,对输入值进行处理。