Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js trigger click

const body = document.body;

body.addEventListener('click', e => {
  console.log('clicked body');
});

console.log('Using click()');
body.click();

console.log('Using dispatchEvent');
body.dispatchEvent(new Event('click'));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #trigger #click
ADD COMMENT
Topic
Name
2+5 =