JSFiddle - React, Tailwind, and code Playground
by gilly3
HTML
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.21/themes/black-tie/jquery-ui.css">
<a target="_top" href="http://stackoverflow.com/a/11532877/361684">Stackoverflow</a>
<br/>
<a target="_top" href="http://google.com">Google</a>
<div id="dialog-confirm">
<div class="message">Are you sure?</div>
<div class="buttons">
<a class="cancel" href="#">Cancel</a>
<a class="ok" href="#">Ok</a>
</div>
</div>
JavaScript
$(function() {
$("#dialog-confirm").dialog({ autoOpen: false }).find("a.cancel").click(function(e){
e.preventDefault();
$("#dialog-confirm").dialog("close");
});
$("a[href]:not(#dialog-confirm a)").click(function(e) {
e.preventDefault();
$("#dialog-confirm").dialog("option", "title", $(this).text()).dialog("open").find("a.ok").attr({href: this.href, target: this.target});
});
});