jQuery不断扩大和缩小的textarea [英] Jquery growing and shrinking textarea

查看:76
本文介绍了jQuery不断扩大和缩小的textarea的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您按Enter键时,我试图使文本区域增大,当您删除行时,请收缩文本区域.换句话说,在编辑文本时,文本区域的大小足以容纳其中的文本.

I'm trying to make a textarea grow when you press enter and shrink when you finish deleting a line. In other words, the textarea remains just big enough to contain the text inside of it, while the text is being edited.

除非有人知道更好的方法,否则现在我正在使用jquery检测按键.在Enter印刷机上使文本区域变大是相当容易的,但是当您删除回车符时,如何缩小文本区域我是茫然的.

Unless anyone knows a better way to do this, right now I'm doing it with jquery detecting keypresses. It's fairly easy to make the textarea larger on an enter press, but I'm at a loss as to how to make it shrink when you delete a carriage return.

您(最好是使用jquery)如何检测何时在文本区域中删除回车符?

How do you (preferably with jquery) detect when a carriage return is deleted in a textarea?

推荐答案

尝试使用TextArea调整大小插件:

Try the TextArea resizer plugin:

http://plugins.jquery.com/project/TextAreaResizer

这篇关于jQuery不断扩大和缩小的textarea的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆