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.
谁能告诉如何限制打字时textarea的增长?我尝试使用 max-height 属性,但没有用...... textarea 继续增长超过页面高度。
尝试,
$(function(){ $(document).on('keydown','textarea',function(){ // you can change window to your container if($(window).height()==$(this).height()) return false; }); });