A list of html TextArea element with class name "noteItem", below code will auto resize the TextArea to avoid scrollbar
JQuery:
$(‘.noteItem‘).each(function () {
var scrollHeight = $(this).prop(‘scrollHeight‘);
$(this).css(‘height‘,‘auto‘);
$(this).css(‘height‘, scrollHeight + ‘px‘);
});
reference - http://stackoverflow.com/questions/5980150/jquery-js-get-the-scrollbar-height-of-an-textarea
时间: 2024-08-27 11:14:42