[英]How to close only current popup in Javascript and Jquery?
I have a form as a popup and I want to add a cancel button to close current popup.我有一个表单作为弹出窗口,我想添加一个取消按钮来关闭当前弹出窗口。 I tried many ways to do it but it is not closing我尝试了很多方法来做到这一点,但它没有关闭
<form id="overlay_form_uploadGenFile" action="/crm/saveGeneralFile" method="POST" class="overlay_form" style="display:none" enctype="multipart/form-data">
<h1 style="font-size: 2em">Edit uploaded file</h1>
<input type="hidden" name="fileId" value="0"/>
<input type="hidden" name="userId" value="{{userId}}"/>
<span>Category:</span><span id="file-filter-by">Filter by:</span> <select name="fileCategoryTagId" onchange="populatePopupCategories(this);"></select>
<div id="file-category-select"><select name="fileCategoryId" onchange="getShareWithIntegrationServicesForPopup(this.options[this.selectedIndex].value);"></select></div><br/>
Current File: <input type="text" name="filename" class="currentFile"/> (change it to rename the file)<br/><br/>
To replace <input type="file" name="fileData" class="replaceFile" /><br/><br/>
<input type="checkbox" name="editableByHR" class="editableHR"/> Editable by HR
<input type="checkbox" name="sharedWithEmployee" /> Shared With Employee <br/>
Notes <textarea name="notes" class="fileUpdateNotes"></textarea><br/><br/>
<br/>
<div class="integrationServicesContainerHolder">
</div>
<br/>
<div style="display: inline-block;width: 100%">
<div align="left" style="float: left">
<input type="submit" value="Save" align="left" class="submitFileUpdateButton"/>
<input type="button" value="Cancel" onclick="closeFunction" align="left" class="submitFileUpdateButton"/>
</div>
<div align="right" style="float: right">
<input type="submit" value="Delete" align="right" class="submitFileUpdateButton"/>
</div>
</div>
</form>
and the function side is function 侧是
function closeFunction() {
$('#overlay_form_uploadGenFile').hide();
}
I have tried .dialog('hide')
and .modal('hide')
as well but still not working.我也尝试过.dialog('hide')
和.modal('hide')
但仍然无法正常工作。 If I try self.closeAll then it is closing all tab.如果我尝试 self.closeAll 那么它正在关闭所有选项卡。 How can I close only this form dialog popup?如何仅关闭此表单对话框弹出窗口?
edit: ok I put $('#overlay_form_uploadGenFile').fadeOut(100);
编辑:好的,我把$('#overlay_form_uploadGenFile').fadeOut(100);
and problem is solved almost... I need immediate close because fadeOut is blocking me for calling other functions due to asynchronous calls.问题几乎解决了……我需要立即关闭,因为由于异步调用,fadeOut 阻止了我调用其他函数。
My suggestion would be to use the break
function.我的建议是使用break
function。 That will exit the current loop.这将退出当前循环。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.