JSFiddle - React, Tailwind, and code Playground
HTML
<!doctype html>
<html>
<body>
<a href="https://www.bing.com/">Click Me</a>
<br><br>
<button id="submit">Submit</button>
</body>
</html>
JavaScript
document.getElementById('submit').onclick = function() {
var href = document.querySelector('a').getAttribute('href');
alert(href);
}