Echo
Echo

Reputation: 3029

Confirmation Dialog with radio buttons using JQuery

I have a very basic confirmation dialog that have 2 buttons:"Ok" & "Cancel". Here is the demo :http://jsfiddle.net/VQmAm/11/

Now I need to add to that confirmation dialog: some radio buttons and the user would select only one of these values and I would take that value to use it later.

I have found set of ways to do that other than JQuery, but I was wondering if I can do that via JQuery!

Upvotes: 3

Views: 4085

Answers (1)

ezakto
ezakto

Reputation: 3194

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

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

Note that you get the value before removing the dialog. And you should define the var value outside the function.

Upvotes: 3

Related Questions