使用jQuery关闭弹出窗口

使用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