Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
SQL
i am working on mvc application. a record of this project is display when i click on one of them then a popup open(using jquery). in this popup two button namely view and close. when i click on view button then a new popup one(using jquery) and in this popup also have two button namely submit and close. when i click on close button of current popup both popup are being close but i want to close current popup. how can i do this
please help

thanks in advance
Posted
Comments
Jameel VM 18-Aug-14 9:53am    
please post the code you have tried so far
Sergey Alexandrovich Kryukov 18-Aug-14 12:05pm    
It it jQuery "dialog" ("modal popup") or popup created with window.open?
—SA

1 solution

This is a little less obvious in jQuery than you would expect at first glance. There are 2 ways to do it, either invoke the specific dialog:

JavaScript
onclick="$('#myDialog').dialog('close');"


or locate it, assuming that you're clicking a child element ( in the titlebar or body):

JavaScript
onclick="$(this).closest('.ui-dialog').children('.ui-dialog-content').dialog('close');"


The latter is pretty much the only way to close an anonymous dialog unless you want to wire in a tracking system for your windows.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 18-Aug-14 12:06pm    
Not sure OP talks about a dialog; it could be popup created with window.open. It would be better to wait OS's clarification.
—SA
Nathan Minier 18-Aug-14 12:16pm    
Assumptive on my part, agreed, but sticking by it mainly because window.open is JS and not jQuery.

In my heart I hope that people know the difference before trying to put code to digits, but in my head realize that it's not necessarily true.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900