我有一些通用div,它在屏幕上多次创建,没有id。每个表格都通过“确定”按钮转换为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");
            }
        }
    ]
});

最佳答案

检查这是否有效?

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

关于javascript - 获取事件的jQuery UI对话框,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37138192/

10-16 22:39