Confirmation dialog using radio buttons using jQuery

I have a very basic confirmation dialog that has two buttons: OK and Cancel. Here is a demo: http://jsfiddle.net/VQmAm/11/

Now I need to add confirmation to this dialog: some switches, and the user will select only one of these values, and I would use this value to use it later.

I found many ways to do this other than jQuery, but I was wondering if I can do this through jQuery!

+3
source share
1 answer

Add radio buttons (with the same attribute name) to the #confirmDialog div. Then you can get the selected value using the OK button:

        'OK': function() {
            value = $(this).find('input:checked').val();
            $(this).remove();
        },

Note that you get the value before deleting the dialog. And you must define var valueoutside the function.

+3
source

All Articles