2

I'm using React.js and I want to listen for any change on this div (its textContent) with contentEditable=true.

render() {
  return (
    <div contentEditable=true > Hello </div>
  )
}
Zsolt Meszaros
  • 21,961
  • 19
  • 54
  • 57
Mister.Perfect
  • 198
  • 1
  • 7
  • 1
    check [this answer](https://stackoverflow.com/questions/1391278/contenteditable-change-events) – Eldshe Jan 02 '21 at 18:02

1 Answers1

3

Try this:

<div
  contentEditable="true"
  onInput={(e) => {
    console.log("woohoo!");
  }}>Hello</div>
Or Assayag
  • 5,662
  • 13
  • 57
  • 93