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.
如何在zend中为textarea设置最大字符限制,如300个字符
我不认为有一个简单的方法。如果您假设显示浏览器的 HTML5 功能,您可以使用 textarea 的继承 setAttrib 方法来设置 maxlength 属性。如果您想更加兼容,则必须坚持使用 javascript 解决方案。两种方法都是客户端限制!提交表格后,您应始终检查长度。