r.createElement("div", {
dangerouslySetInnerHTML: {
__html: e
},
dir: "auto",
ref: "input",
spellCheck: this.props.spellCheck,
"data-tab": this.props.editable ? 1 : null ,
contentEditable: this.props.editable,
className: t,
onInput: this.onInput,
onPaste: this.onPaste,
onCut: this.onCut,
onKeyUp: this.onKeyUp,
onKeyPress: this.onKeyPress,
onMouseDown: this.onMouseDown,
onContextMenu: this.onContextMenu,
onFocus: this.props.onFocus,
onBlur: this.props.onBlur
}
I am trying to set the content to that element from the client chrome browser console and it's not triggering the onInput event.
Is there a way to add input dynamically and call onInput event which is attached for the element?
you can dispatch event from console
1.find dom node through querySelector.. , or select element in "Elements" tab and use $0;
const input = document.querySelector('[contentEditable]');
2.create event
const eventX = new Event('input', {bubbles: true});
3.change value
input.textContent = "TEST";
4.dispatch event
input.dispatchEvent(eventX)
jsfiddle DEMO test

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