JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css">
<button id="button">Clicky</button>
JavaScript
function getConfirmationDialog(text, action) {
$('html').append('<div id="confirmDialog"><p>' + text + '</p></div>');
var confirmDialog = $('#confirmDialog');
confirmDialog
.dialog({
modal: true,
autoOpen: false,
title: 'Please confirm',
width: 300,
height: 180,
buttons: {
'OK': function() {
$(this).remove();
action();
},
Cancel: function() {
$(this).remove();
}
}
});
confirmDialog.dialog('open');
}
function doAction() {
alert('booyah');
}
$('#button').click(function() {
getConfirmationDialog('Hello world?', doAction);
});