Sep 4, 2026
Web platform gotcha: mutating .innerText on a <textarea> does not reliably update what is displayed or copyable once the browser treats it as an editable value. Burned time debugging "missing" data that was arriving fine the whole time. Use <pre>/<div> for live logs instead.
// Don't do this for a live-updating log/debug display
const textarea = document.querySelector( 'textarea' );
// May not show up on screen
textarea.innerText += 'new line\n';
// Do this instead
// <pre>/<div> have no value/dirty-flag mechanism to fight
const log = document.querySelector( 'pre' );
log.innerText += 'new line\n';
Back to Notes