yossi
yossi

Reputation: 3164

Get the active jQuery UI dialog

I have some generic div's that is created several times on the screen, with no id. each form is converted to dialog with an "ok" button.

the "ok" is triggering some logic and is valid to the current dialog.

how can i access ONLY the inputs that in the active dialog?

<div class="ranges-editor">
    <input class="a" />
</div>

<div class="ranges-editor">
    <input class="a" />
</div>

$(".ranges-editor").dialog({
    autoOpen: false,
    width: "auto",
    height: "auto",
    buttons: [
        {
            text: "Update",
            click: function () {
                alert($(".a").val());
                $(this).dialog("close");
            }
        }
    ]
});

Upvotes: 0

Views: 928

Answers (1)

Naqash Malik
Naqash Malik

Reputation: 1816

check if this is working?

$(".ranges-editor").dialog({
    autoOpen: false,
    width: "auto",
    height: "auto",
    buttons: [
        {
            text: "Update",
            click: function () {
                alert($(this).find(".a").val());
                $(this).dialog("close");
            }
        }
    ]
});

Upvotes: 1

Related Questions