简体   繁体   English

如何仅关闭 Javascript 和 Jquery 中的当前弹出窗口?

[英]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.

相关问题 如何通过 jquery 关闭 magnific popup - How to close magnific popup by jquery 使用javascript / jquery在窗口关闭时弹出模态 - Modal popup on window close using javascript/jquery 如何使用JavaScript / Jquery在浏览器关闭选项卡上显示带有自定义HTML的弹出窗口? 我有自定义HTML弹出窗口 - How to display popup with custom HTML on browser close tab using JavaScript/Jquery ? I have custom HTML popup 如何使用 javascript 或 jquery 关闭当前窗口或选项卡 - How to close current window or tab using javascript or jquery 如何在 javascript 中绑定我当前的 Popup 代码以每天仅显示一次弹出窗口? - How to bind my current Popup code in javascript to show the popup only once per day? window.close()仅在IE中有效。 如何使用javascript关闭firefox窗口中的当前选项卡? - window.close() is working only in IE. How to close current tab in firefox window using javascript? 如何使用javascript关闭点击按钮上的特定链接? window.close仅关闭我当前的窗口 - how to close a particular link on click button using javascript?? window.close is closing my current window only 如何等待jQuery Mobile中的弹出窗口关闭? - How to wait for a popup to close in jQuery Mobile? 如何成功关闭jquery弹出框? - How can close jquery popup box on success? 如何在JavaScript中基于URL关闭弹出窗口 - How to close popup window based on url in javascript
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM