动态调整输入大小 [英] Dynamically resize input
本文介绍了动态调整输入大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只是想知道如何在输入时动态调整输入大小???
I was just wondering how do you dynamically resize an input as you type in it??
我想尽可能使用jQuery&我宁愿它是一个小脚本,而不是一个笨重的插件。
I'd like to use jQuery if possible & I would rather it be a small script than a bulky plugin.
请告诉我,
Matt Mueller
Please let me know, Matt Mueller
推荐答案
这是一个快速(未经测试)的解决方案
Here's a quick (untested) solution
$('input[type="text"]').keyup(function(){
$(this).attr({width: 'auto', size: $(this).val().length});
});
这篇关于动态调整输入大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文