0

I want to check the contents of the alert before it "alerts".

I have this function:

function alert(msg) {

    // THIS WILL CHECK IF THE WORD FUNCTION IS EXISTING IN A STRING
    var searchFunction = jQuery.type(msg);

    if(searchFunction != 'function')
    {
        return;
    }
}

However, I don't know how to "alert" since I modified the alert function already.

Thanks in advance!

comebal
  • 946
  • 3
  • 14
  • 30
  • Why would you want to pass a string with the word "function" to this method and what would you do if that is the case? – Esko Apr 11 '14 at 06:14
  • 1
    http://stackoverflow.com/questions/10427708/override-function-e-g-alert-and-call-the-original-function – Roland Jansen Apr 11 '14 at 06:15

1 Answers1

0

However, I don't know how to "alert" since I modified the alert function already.

Before modifying the alert, do this:

var myAlert = alert;

Now you can do myAlert("Hi, I am a alert");

Amit Joki
  • 58,320
  • 7
  • 77
  • 95