I am not developing in React.js, but I am working on a chrome extension that should programmatically populate form values for different types of sites.
The site uses React.js, and I fill in the value in the usual way:
element = document.querySelector("input[name=firstName]");
element.value = "something";
When the user clicks the submit button, he receives this error for this form element, even if the element has the value: "This information is required."
This does not help if the event “change” the fire for this element.
evt = document.createEvent("HTMLEvents");
evt.initEvent("change", false, true);
element.dispatchEvent(evt);
Is there a method in the React.js structure that I need to call to programmatically change the value? Help from experienced React.js users is appreciated!