如何在Javascript和Jquery中仅关闭当前弹出窗口?
我有一个窗体作为弹出窗口,我想添加一个取消按钮来关闭当前弹出窗口。我尝试了很多方法,但都没有成功如何在Javascript和Jquery中仅关闭当前弹出窗口?,javascript,jquery,html,Javascript,Jquery,Html,我有一个窗体作为弹出窗口,我想添加一个取消按钮来关闭当前弹出窗口。我尝试了很多方法,但都没有成功 <form id="overlay_form_uploadGenFile" action="/crm/saveGeneralFile" method="POST" class="overlay_form" style="display:none" enctype="multipart/form-data"> <h1 style="font-size: 2e
<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>
我也尝试过.dialog('hide')
和.modal('hide')
,但仍然不起作用。如果我尝试self.closeAll,那么它将关闭所有选项卡。如何仅关闭此窗体对话框弹出窗口
编辑:好,我把
$('#overlay_form_uploadGenFile').fadeOut(100)代码>问题几乎解决了。。。我需要立即关闭,因为fadeOut由于异步调用而阻止我调用其他函数。我的建议是使用break
函数。这将退出当前循环。ID不匹配。在函数中是#overlay_form_downloadGenFile,但弹出窗口中有#overlay_form_uploadGenFile。我已经编辑过了。但它仍然没有关闭fadeOut可以将回调函数作为第二个参数$('#overlay_form_uploadGenFile')。fadeOut(100,函数completefadeOutCallback(){//to do after fade out})
function closeFunction() {
$('#overlay_form_uploadGenFile').hide();
}