JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<h2 onclick="changeLink(sites.google);">Google</h2>
<h2 onclick="changeLink(sites.yahoo);">Yahoo</h2>
<h2 onclick="changeLink(sites.duck);">DuckDuckGo</h2>
<a href="http://www.example.com" target="_blank" id="target">http://www.example.com</a>
</body>
CSS
h2:hover{
color: blue;
cursor: pointer;
}
JavaScript
var sites = {
"google": "http://www.google.com",
"yahoo": "http://www.yahoo.com",
"duck": "http://www.duckduckgo.com"
};
function changeLink(site){
document.getElementById("target").href = site;
document.getElementById("target").innerHTML = site;
}