获取活动的 jQuery UI 对话框
Get the active jQuery UI dialog
我有一些通用的 div 在屏幕上创建了好几次,没有 ID。每个表单都使用 "ok" 按钮转换为 dialog
。
"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");
}
}
]
});
我有一些通用的 div 在屏幕上创建了好几次,没有 ID。每个表单都使用 "ok" 按钮转换为 dialog
。
"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");
}
}
]
});