Last active
May 9, 2022 10:36
-
-
Save MarekZeman91/c34bca3f83050a5e84a086a34ffac44f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const setText = (input: HTMLInputElement, value: string): void => { | |
const prototype = Object.getPrototypeOf(input); | |
const valueSetter = Object.getOwnPropertyDescriptor(prototype, 'value').set; | |
valueSetter.call(input, value); | |
const init = { bubbles: true, cancelable: true }; | |
input.dispatchEvent(new Event('change', init)); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment