views:

64

answers:

1

Hi folks, I'm trying to impliment a confirmation box, but I need to edit the text with html. So I found the jquery "confirm override" here: http://www.ericmmartin.com/projects/simplemodal-demos/

He mentions here about styling the string with html: http://www.ericmmartin.com/projects/simplemodal/

But I don't inderstand where in my function I am supposed to do that? Here is the function:

$(document).ready(function () {
    $('#confirm-dialog input.confirm, #confirm-dialog a.confirm').click(function (e) {
        e.preventDefault();

        // example of calling the confirm function
        // you must use a callback function to perform the "yes" action
        confirm("Continue to the SimpleModal Project page?", function () {
            window.location.href = 'http://www.ericmmartin.com/projects/simplemodal/';
        });
    });
});

function confirm(message, callback) {
    $('#confirm').modal({
        closeHTML:"<a href='#' title='Close' class='modal-close'>x</a>",
        position: ["20%",],
        overlayId:'confirm-overlay',
        containerId:'confirm-container', 
        onShow: function (dialog) {
            $('.message', dialog.data[0]).append(message);

            // if the user clicks "yes"
            $('.yes', dialog.data[0]).click(function () {
                // call the callback
                if ($.isFunction(callback)) {
                    callback.apply();
                }
                // close the dialog
                $.modal.close();
            });
        }
    });
}

Thank you for any help!

Basically instead of confirm("Continue to the SimpleModal Project page?", function () I need to have an unordered list in ther (terms of service)

+1  A: 

Have you tried passing HTML as the first argument?

Your code should work fine like this

confirm('<ul><li>somedata</li><li>moredata</li></ul>', function(){});

because your confirm function appends the message variable.

czarchaic
That did it. Awesome. Thanks so much!
Joel