144
rated 0 times
[
151]
[
7]
/ answers: 1 / hits: 101259
/ 7 Years ago, wed, september 13, 2017, 12:00:00
I would like to trigger a click event on a HTML element in Typescript/Reactjs.
let element: Element = document.getElementsByClassName('btn')[0];
element.click();
The code above does work. But I'm getting a Typescript error:
ERROR in [at-loader] ./src/App.tsx:124:17
TS2339: Property 'click' does not exist on type 'Element'.
So what would be the correct way to do this?
More From » reactjs