Divante Posted June 16, 2011 Share Posted June 16, 2011 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; }); }); } } Quote Link to comment https://forums.phpfreaks.com/topic/239509-custom-javascript-alert-box/ Share on other sites More sharing options...
Omirion Posted June 16, 2011 Share Posted June 16, 2011 The JQuery.ready function is pointless in the code you posted. Call the check() function inside the JQ(doc).ready() function. That should solve your issue because you might be calling the function before the document is loaded. Quote Link to comment https://forums.phpfreaks.com/topic/239509-custom-javascript-alert-box/#findComment-1230390 Share on other sites More sharing options...
RichardRotterdam Posted June 19, 2011 Share Posted June 19, 2011 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 Quote Link to comment https://forums.phpfreaks.com/topic/239509-custom-javascript-alert-box/#findComment-1231714 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.