JSFiddle - React, Tailwind, and code Playground
HTML
<a class="preventable" onclick="defaultAction()">Click ME</a>
JavaScript
window.defaultAction = function () {
alert("Clicked1")
}
var check = null;
$(document).ready(function () {
$(".preventable").on("click", function(e) {
if(check == null) {
e.stopImmediatePropagation();
alert("hijacked")
check = true; //confirm here
} else if(check == true){
$('.preventable').click();
}
})
$(".preventable").on("click", function(e) { alert("clicked2"); })
});