Is it possible to use onchange
event in a <div>
?
Because my <div>
changes its text inside.
Can I do something like this?
<div id="name" onchange="calculateTotal();"></div>
You can use 'onInput' instead of 'onChange'.
<div className="inputDiv" contenteditable="true" onInput={(e) => { console.log(e.currentTarget.textContent) }} />
Check the console log with Chrome Developer Tools (F12):
References: https://stackoverflow.com/a/52614631/8706661
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With