javascript - changing React.js form values from a chrome extension -
i'm not developing in react.js, i'm working on chrome extension needs programatically fill form values different kinds of sites.
the site uses react.js, , i'm filling value in usual way with:
element = document.queryselector("input[name=firstname]"); element.value = "something";
when user clicks submit button, gets error form element, if element has value: "this information required."
it doesn't if fire "change" event element.
evt = document.createevent("htmlevents"); evt.initevent("change", false, true); element.dispatchevent(evt);
there method in react.js framework need call programatically change value? react.js experienced users appreciated!
i found solution. call element.select();
before changing value.
Comments
Post a Comment