<fieldset>
<legend>Your comments</legend>
<p><textarea class="no-scrollbars"></textarea></p>
</fieldset>HTMLTextAreaElement / notebook
HTMLTextAreaElement
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
textarea.no-scrollbars {
overflow: hidden;
width: 300px;
height: 100px;
}function autoGrow(field) {
if (field.scrollHeight > field.clientHeight) {
field.style.height = `${field.scrollHeight}px`;
}
}
document.querySelector("textarea").addEventListener("keyup", (e) => {
autoGrow(e.target);
});