简体   繁体   中英

Hide pop up onclick button

once we click on login , we want to hide the entire pop up box. I tried as below code.

在此处输入图片说明

<div class="ajaxlogin-window">
<div id="ajaxlogin-login-window">
<!-- other code -->
<button class="button"  id="send2" id="close" onclick="window.ajaxlogin-login-window()" >
Login
</button>

also i tried onclick="parentNode.remove()" but it hide only bottom half of pop up. tried lot of other things. so tried to use same code that close button is using as below. but nothing worked for me.

close button :

<a href="javascript:void(0)" class="close">Login button</a>

在此处输入图片说明

script

document.observe("dom:loaded", function() {
        var triggers = {
            login: {
                el    : $$('.ajaxlogin-login'),
                event : 'click',
                window: $('ajaxlogin-login-window'),
                size: {
                    maxWidth: 300
                }
            },

First add id attribute for the parent div

<div id="mydiv" class="ajaxlogin-window">

now use this script

function hide() {
    document.getElementById('mydiv').style.display = 'none';
}

then add the onclick event to your button like this

<button class="button"  id="send2" onclick="hide()" >
Login
</button>

this should work

Add display:none on main div of popup from js when you click button.

$(document).('on','click',function(){
 <div id="div1">//your main popup div like this
 document.getElementById('div1').style.display = 'none';
})

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM