sS hjs_autoExpandingTextAreas() { var autoExpandTextarea = function (field) { // Reset field height field.style.height = 'inherit'; // Get the computed styles for the element var computed = window.getComputedStyle(field); // Calculate the height var height = parseInt(computed.getPropertyValue('border-top-width'), 10) + parseInt(computed.getPropertyValue('padding-top'), 10) + field.scrollHeight + parseInt(computed.getPropertyValue('padding-bottom'), 10) + parseInt(computed.getPropertyValue('border-bottom-width'), 10); field.style.height = height + 'px'; }; document.addEventListener('input', function (event) { if (event.target.tagName.toLowerCase() !== 'textarea') return; if (!element.classList.contains("auto-expand")) return; autoExpandTextarea(event.target); }, false); ]]); }