JSFiddle - React, Tailwind, and code Playground
HTML
<html>
<head>
<title>Test</title>
</head>
<body>
<a id='link1'>one</a>
<a id='link2'>two</a>
<a id='link3'>three</a>
<script language='javascript'>
function goToSite(where){
alert("This would take you to " + x + ".com")
}
for(var x=1; x<=3; x++){
document.getElementById('link'+x).addEventListener('click', function(){goToSite(x)})
}
</script>
</body>
</html>