gpt4 book ai didi

jquery - 如何在(X)关闭按钮单击事件上关闭对话框?

转载 作者:行者123 更新时间:2023-12-01 05:56:54 28 4
gpt4 key购买 nike

我的移动网站有一些多选控件。项目数量较少 (5) 的多选通常会显示为多选(移动样式/格式),但项目数多于 5 的多选会在新页面中显示为对话框 View 。由于某种原因,X 按钮没有响应并且没有关闭效果。我应该怎么做才能使 X 按钮起作用?多选代码:

<div class="field ">
<label for="offices" class="select">
Office(s):
</label>
@Html.ListBoxFor(m => m.Offices, Model.ListOfOffices, new { Multiple = "multiple", data_theme = "a", data_overlay_theme = "c", inline = "true", data_native_menu = "false" })
</div>

jquery 代码:

$(".ui-icon-delete").click(function () {
//$('.ui-dialog').hide(); no effect
//$('div[data-role="dialog"]').popup("close"); no effect
//$('div[data-role="dialog"]').dialog("close"); no effect
//$('ui-dialog').dialog('close'); no effect
$(this).parent().remove(); // this one close the dialog, but also remove the X button
});

谢谢!

最佳答案

您的对话框应该有一个与之关联的 ID。考虑到您的对话框已正确启动,您应该能够执行以下操作:

<div id="dialog">
<label for="offices" class="select">
Office(s):
</label>
@Html.ListBoxFor(m => m.Offices, Model.ListOfOffices, new { Multiple = "multiple", data_theme = "a", data_overlay_theme = "c", inline = "true", data_native_menu = "false" })
</div>

关闭:

$(".ui-icon-delete").click(function () {
$('#dialog').dialog('close');
}

关于jquery - 如何在(X)关闭按钮单击事件上关闭对话框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14852579/

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