1

I need to alert users about unsaved changes before they leave a page.But i dont want to use the default alert box for that . Suppose consider calling showalertPopup() Function displays the my designed alert box . How to replace it with the default alert box

 window.onbeforeunload = function() {
        $alertMsg = "Are you sure wanna leave this Page ?"
        return $alertMsg;
    };
Kunj
  • 1,980
  • 2
  • 22
  • 34
user3383301
  • 1,891
  • 3
  • 21
  • 49
  • `errorMessages` must return a string. That's said, you cannot use an alert box instead of the native prompt box – A. Wolff Apr 29 '14 at 11:42
  • Changed ! errorMessages will return string only . Theres no way of repacing native prompt box ah ? Any jquery plugins like that ? – user3383301 Apr 29 '14 at 11:45
  • http://stackoverflow.com/questions/17648522/custom-alert-and-confirm-box-in-jquery This post can help you i think ! – Superdrac Apr 29 '14 at 11:45
  • 1
    I am referring to my old answer: http://stackoverflow.com/a/23236794/3509874 – urbz Apr 29 '14 at 11:49
  • 1
    @user3383301 jQuery is javascript. What cannot be done in javascript, cannot be done using jQuery – A. Wolff Apr 29 '14 at 11:49
  • The easiest way is to hide and display a div instead of using an alert. then you can customise your div – Whitney R. Apr 29 '14 at 12:12

0 Answers0