Essentially, I want to trigger the input button in the page using TypeScript
3 Answers
//its no different than doing it in vanilla JS
let elem = document.getElementById('submitBtn');
let evt = new MouseEvent('click', {
bubbles: true,
cancelable: true,
view: window
});
elem.dispatchEvent(evt);
1 Comment
Techdive
I am getting error -ERROR TypeError: Cannot read property 'dispatchEvent' of null