element height after content change
- by Neph
I have a snippet of code that alters the contents of a DIV to match the contents of a textarea and then applies the height change in the DIV to the textarea element.
function growTextArea(parameter) {
$('div').find("[data-fieldid='1_description']").text($(parameter).val());
// No Works
height = $('.hiddenDiv').find("[data-fieldid='1_description']").outerHeight();
alert(height);
// Works
heightDiv = $('.hiddenDiv').outerHeight();
alert(heightDiv);
$(parameter).css('height', $('div').find("[data-fieldid='1_description']").outerHeight());
}
The DIV contents change properly, so the search function is working properly, however the search function always returns the original height of the DIV. The function is called by onKeyUp in the textarea. If the .find is swapped out for a .hiddenDiv the height change is reflected properly.