添加onChange或onInput事件监听器。这就是你可以做到的。let textarea = document.querySelector("textarea");textarea.addEventLisenter("input", e => { // Text in your textarea; let value = e.target.value; // to change your text area input let newValue = e.target.value.replace(/some regex/, "new value"); e.target.value = newValue;})