I know that when using jQuery you can do $(\'element\').click();
to catch the click event of an HTML element, but how do you do that with plain Javascript?
Thanks to vanilla js
document.addEventListener('click', function (event) {
// If the clicked element doesn't have the right selector, bail
if (!event.target.matches('input')) return;
// Don't follow the link
event.preventDefault();
// Log the clicked element in the console
console.log(event.target);
}, false);
This also show which element is c