Reputation: 333
How do i place the alert box at the center of the browser and is it possible to change the "Javascript" text in the alert box to something like "Page Reloading"
$('#reload').click(function(e) {
if (confirm('Are you sure')) window.location.reload()
});
Upvotes: 3
Views: 583
Reputation: 1411
you can use jQuery UI dialog widget...
$(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");
});
});
Upvotes: 1