JQuery自动调整textarea内容高度
admin 阅读:122 2024-03-03
// 自动伸缩,自动提交
$('textarea').keyup(function(e) {
if((e.ctrlKey && (e.which == 13 || e.which == 10)) || (e.altKey && e.which == 83)) {
//Ctrl+Enter执行
return false;
}
if(e.which == 13){ //输入回车键
var h = $(this)[0].scrollHeight;
if(h <= 100) {
return true;
} else {
$(this).height($(this)[0].scrollHeight);
return true;
}
}
});声明
1、部分文章来源于网络,仅作为参考。 2、如果网站中图片和文字侵犯了您的版权,请联系1943759704@qq.com处理!



