1

I want the message "Leaving page will cause loss of data" to be bold. could you please help me?

$(window).bind("beforeunload", function(e) {
    return "Leaving page will cause loss of data";
}).unload(function() {
    // what if they choose 'leave this page'; 
});   
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
  • 4
    The message box which is shown is controlled by the browser/OS at a lower level than JS has access to. You cannot change it. – Rory McCrossan Jan 22 '16 at 09:37

1 Answers1

1

The answer is no , you can not style alerts or confirm messages that are shown by the browser. What you can do is write your own modal to pop up , jquery has code that makes that process pretty easy bootstrap does as well. They will be far from the default browser looking alert , but they can be customized to look anyway you would like

Scott Selby
  • 9,420
  • 12
  • 57
  • 96