extraRice
extraRice

Reputation: 333

Center alertbox and change 'Javascript' text in the alertbox

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()
});

http://jsfiddle.net/wvNrC/1/

Upvotes: 3

Views: 583

Answers (1)

Psych Half
Psych Half

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");

  });

});

js fiddle

Upvotes: 1

Related Questions