JSFiddle - React, Tailwind, and code Playground
by David Thomas
HTML
<a href="http://davidrhysthomas.co.uk/">Leave site</a>
JavaScript
var aElems = document.getElementsByTagName('a');
for (var i = 0, len = aElems.length; i < len; i++) {
aElems[i].onclick = function() {
return confirm("Are you sure you want to leave?");
};
}