-1

I have absolutely no idea about Javascript and don't know if it is even possible. Anyway, I found a script that customizes Javascript Alert Box. It works nicely. The issue I am having is that this customization works based on 'onClick' as below:

    // Standard Dialogs
    $("#alert").on( 'click', function () {
        reset();
        alertify.alert("This is an alert dialog");
        return false;
    });

However, my Alert Box is generated by different code, and it either generates Alert Box or redirects to another page, but has nothing to do with onClick function. My question is:

is it possible to customize the Alert Box which is generated outside of the onClick function? If so, could anyone let me know how?

And my sincere apologies if that subject was already explained somewhere - I was looking for an answer but could not find.

Thank you

Ousmane D.
  • 54,915
  • 8
  • 91
  • 126
Maevari
  • 43
  • 7
  • "so youve copied some code somewhere, and now you pasted it here and want us to rewrite it for you?".includes("effort")?"youre allowed to ask":"please try yourself!"; – Jonas Wilms Jun 24 '17 at 12:06
  • Did you try it `alertify.alert("This is an alert dialog");` outside the function. and get an error! – Mohamed Abbas Jun 24 '17 at 12:07
  • Follow the documentation for the `alertify` script you are using. Beyond that we have no idea what *"customize"* means specifically – charlietfl Jun 24 '17 at 12:07
  • Have you tried to check docs? http://alertifyjs.com/ – FieryCat Jun 24 '17 at 12:14
  • Could you explain, when you want to get the alert , eg : hover a mouse over the link ? – Kuhan Jun 24 '17 at 12:19

1 Answers1

1

If you're trying to have the alert pop up initially without prompt it appears you will need:

alertify.alert("This is an alert dialog"); 

to be pasted outside of the function.

This will trigger the alert when the page loads as long as your tags are at the bottom of your html &/or you've used a document.ready statement.


My other interpretation of your above message is that the code above works and another alert box doesn't in which case can you please show us the code from the code that is not displaying as customised.

Kingswell
  • 116
  • 1
  • 2