I have a textarea in a form that users frequently use. When a user manually adjusts the size of the textarea using the resize thing in the bottom-right corner of the textarea, I save the height to localStorage. I want to set the textarea height to the height saved in localStorage but when I do the textarea can't be resized smaller than the height that was set.
It works fine in Firefox but not in Chrome.
I'm currently setting the height using jQuery's .height(). I've also tried .outerHeight(), .css(), .style, .setProperty(). None worked.
Code I'm working with:
id = params.id ? params.id : $el.attr('id');
lsHeight = localStorage.getItem('textareaOuterHeight-' + id);
if (lsHeight != null) {
$el.height(lsHeight);
}
$el.data('defaultOuterHeight', $el.outerHeight());
$el.on('click', function() {
if ($el.data('defaultOuterHeight') !== $el.outerHeight()) {
localStorage.setItem('textareaOuterHeight-' + id, $el.outerHeight());
}
});