Ferdinand Balbin
Ferdinand Balbin

Reputation: 687

How to close a popup window when a button on the popup window is click?

I have tried a lot of ways/codes to close the popup window when a button in that popup window is click but still it did not work.

The code below was used to create a popup window.

       $.window({

 title:"CourseBooking",
 url: "<?php echo base_url() ?>students/pop_send_mail/",
 width: 450,
 height: 550

          });

below were the codes I tried to close the popup window but all did not work.

     1.  $( "#close_window" ).popup( "close" );
     2.  window.close();
     3.  $.window.close();

Upvotes: 1

Views: 2827

Answers (1)

Ferdinand Balbin
Ferdinand Balbin

Reputation: 687

In the parent window I placed a function called close_Popup().

function closePopup()
 {
$.window.closeAll();
 }

And in the popup window I used also the codes below to call the function in the parent window to close the popup window.

$("#no").click(function()
{

top.closePopup();

});

the "top" javascript function is used to call the function "closePopup()" that resides in the parent window and it solves the problem.

Upvotes: 2

Related Questions