Skip to content

Instantly share code, notes, and snippets.

@Shwartz
Created February 13, 2017 16:44
Show Gist options
  • Save Shwartz/c491a83689f2e225e7cd6d7fd8be8fa4 to your computer and use it in GitHub Desktop.
Save Shwartz/c491a83689f2e225e7cd6d7fd8be8fa4 to your computer and use it in GitHub Desktop.
For testing clickable elements add preventDefault() to all of them
window.addEventListener("load", function () {
console.warn('------------------- EAGLE LANDED -------------------')
let arr = Array.from(document.getElementsByTagName('a'));
console.warn('A TAGS', arr.length);
arr.forEach(function (a) {
a.addEventListener('click', function (e) {
console.warn('CLICK ELEM', e.target);
e.preventDefault();
});
});
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment