gpt4 book ai didi

javascript - 获取事件的 jQuery UI 对话框

转载 作者:行者123 更新时间:2023-12-03 06:59:01 24 4
gpt4 key购买 nike

我有一些通用的 div,它们在屏幕上创建了多次,没有 id。每个表单都会转换为带有“确定”按钮的对话框

“ok”正在触发一些逻辑,并且对当前对话框有效。

我如何才能仅访问事件对话框中的输入?

<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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com