$('[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
这个里面比较全面