#responsive-textarea { .textarea { width: torem(220px); min-height: torem(120px); border: 1px solid var(--grey); outline: none; padding: torem(5px); margin-bottom: torem(10px); } .output { overflow-wrap: break-word; word-break: break-all; } }
import { escapeHTML } from 'zp-lib'; document.addEventListener('DOMContentLoaded', () => { const target = document.querySelector('.textarea'); const output = document.querySelector('.output'); target.addEventListener('input', (e) => { const content = e.target.textContent; output.innerHTML = escapeHTML(content); }, false); }, false);