JSFiddle - React, Tailwind, and code Playground

HTML

<a href="https://www.example.com" onclick="myFunction(event)" target="_blank" rel="nofollow">example.com</a>

JavaScript

function myFunction(e) {
  var confirmresult = confirm("Press a button!");
  if (confirmresult == true) {
    // OK = go away!
  } else {
  	// Cancel = stay here!
	e.preventDefault();
  }
};