JSFiddle - React, Tailwind, and code Playground
HTML
<div id="board_code" contenteditable = "true"></div>
<div id="dialog" title="Page Reloading.">Are you sure</div>
<input type="button" id="reload" value="reload"/>
CSS
#board_code{
white-space: pre-wrap;
background-color: green;
}
JavaScript
$(document).ready(function () {
$("#dialog").dialog({
modal: true,
bgiframe: true,
width: 500,
height: 200,
autoOpen: false
});
$("#reload").click(function (e) {
e.preventDefault();
$("#dialog").dialog('option', 'buttons', {
"Confirm": function () {
window.location.reload();
},
"Cancel": function () {
$(this).dialog("close");
}
});
$("#dialog").dialog("open");
});
});