读书人

输入框自动增多高度

发布时间: 2012-08-28 12:37:01 作者: rapoo

输入框自动增加高度

     $('[item="text_pinglun"]').keyup(function(){ var id = $(this).attr("id");var obj = document.getElementById(id);var sh = obj.scrollHeight; $(this).a("height",sh+"px");     })


不知道jquery里面是否有scrollHeight,找了半天没找到!所以就通过id取了。

http://witmax.cn/javascript-textarea-auto-grow.html
这个里面比较全面

读书人网 >Web前端

热点推荐