Jump to content

CUSTOM JAVASCRIPT ALERT BOX


Divante

Recommended Posts

I am looking for a way to customize javascript alert boxes as far as color and style. Basically to make it look nice and user friendly . I have tried jquery.alerts but to no avail.Probably i am implementing it wrong. i am tryn to verify a radio button has been checked and then based on th eone checked display an alert.

 

 

function checkplan(){

 

if (document.step1.plan[0].checked == true)

{

 

 

$(document).ready( function() {

 

$("#alert_button").submit( function() {

jAlert('This is a custom ', 'Alert Dialog');

return false;

});

 

 

 

});

 

}

}

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/239509-custom-javascript-alert-box/
Share on other sites

Your code:

function checkplan() {
    if (document.step1.plan[0].checked == true) {
        $(document).ready(function () {

            $("#alert_button").submit(function () {
                jAlert('This is a custom ', 'Alert Dialog');
                return false;
            });
        });
    }
}

 

as Omirion said it's a bit pointless to do a domready check inside the function the other way around would be more logical like so:

$(document).ready() {
    // your function call here
    checkplan();
}

 

If I may ask what is this suppose to do?

document.step1.plan[0].checked == true

I'm pretty sure you could write it neater using the jQuery selector.

 

You might also want to take a look at jquery ui

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.