How can you programmatically set the value of an input field generated by React, either with vanilla JS or JQuery?
I've tried the following and nothing seems to work.
$(obj).val('abc');
$(obj).attr('value', 'abc');
$(obj).keydown();
$(obj).keypress();
$(obj).keyup();
$(obj).blur();
$(obj).change();
$(obj).focus();
I've also tried to simulate keyPress
(as suggested here) events but it doesn't seem to work either.
simulateKeyPresses (characters, ...args) {
for (let i = 0; i < characters.length; i++) {
this.simulate('keyPress', extend({
which: characters.charCodeAt(i),
key: characters[i],
keyCode: characters.charCodeAt(i)
}, args));
}
}