使用jQuery关闭弹出窗口 [英] Close popup using jquery

查看:112
本文介绍了使用jQuery关闭弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

谁能告诉我如何使用jquery关闭弹出窗口?
但条件是,jQuery代码应该在javascript函数中.

我的代码:

Hi all,

Can anyone tell me how to close popup using jquery?
but the condition is, jquery code should be in javascript function.

My code:

function ValidateAboutYouMAIN()
{
    //alert("main method call");
    var myVar=validateAboutYou();
//    alert(myVar);
    if(myVar==0)
    {
        alert("value=0");
        $('#aboutYouEditable').fadeOut(500);
    }
    else
    {
        alert("value=1");
    }
}


在上面的代码中,我检查了来自函数


In above code i check return value from function:

validateAboutYou()

的返回值,如果它是0,则div-

and if it is 0, div -

aboutYouEditable

应该关闭.
我已经尝试通过编写document.ready函数,但是仍然无法正常工作..
请建议我关闭popup

should be close.

I have tried by writing document.ready function but still its not working..
Please suggest me to close popup

推荐答案

(' # aboutYouEditable').fadeOut( 500 ); } 其他 { alert(" ); } }
('#aboutYouEditable').fadeOut(500); } else { alert("value=1"); } }


在上面的代码中,我检查了来自函数


In above code i check return value from function:

validateAboutYou()

的返回值,如果它是0,则div-

and if it is 0, div -

aboutYouEditable

应该关闭.
我已经尝试通过编写document.ready函数,但是仍然无法正常工作..
请建议我关闭弹出窗口

should be close.

I have tried by writing document.ready function but still its not working..
Please suggest me to close popup


尝试一下:
Try this:
function ValidateAboutYouMAIN()
{
    var myVar=validateAboutYou();
    if(myVar==0)
    {
        alert("value=0");


(' #aboutYouEditable').fadeOut( 500 ); 窗口 .close(); // 您错过了.尽管您正在使用淡入淡出功能,但还需要使用关闭功能. } 其他 { alert(" ); } }
('#aboutYouEditable').fadeOut(500); window.close(); // You missed. Although you are using fadeout you need to use close function also. } else { alert("value=1"); } }



希望对您有所帮助.
--Amit



Hope it helps.
--Amit


这篇关于使用jQuery关闭弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆