<div>
  <a href="/link1/" data-name="links">LINK 1</a>
<a href="/link2/" data-name="links">LINK 2</a>
<a href="/link3/" data-name="links">LINK 3</a>
<a href="/link4/" data-name="links">LINK 4</a>
<a href="/lnk5/" data-name="links">LINK 5</a>
</div>
const links = document.querySelectorAll('a');

for (const link of links) {
	link.addEventListener('click', (e) => {
		e.preventDefault();
		alert (`Href: ${e.target.href}; Data-name: ${e.target.dataset.name}`);
	});
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.