1,105,332 Community Members

how to close popup window when close button clicked

Member Avatar
Farhad.idrees
Junior Poster
102 posts since Dec 2010
Reputation Points: 1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi i want to close my popup window..
how to do it?
window.close() is not working..

i m showing my popup using jquery..
i want to close popup when close button is clicked..
Regards..
fahrad

Member Avatar
AleMonteiro
Master Poster
758 posts since Aug 2010
Reputation Points: 115 [?]
Q&As Helped to Solve: 143 [?]
Skill Endorsements: 29 [?]
 
0
 

How are you oppening the popup?

Member Avatar
soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 0 [?]
Q&As Helped to Solve: 6 [?]
Skill Endorsements: 0 [?]
 
0
 

Well if you are using jQuery might I reccomend using the dialog feature.

Setting it up is simple

1.) create a div in your html and a button so the dialog can be opened and closed :

//within html

<div id='my_first_dialog'>  <img src='dancing_homer.gif'/> </div> 
 <div id='diag_button'>  CLICK ME!!!!!! </div>

2.) You want to create an event listener so your browser knows to activate the event when the button is open

<script>
 var open = 'no' 
  $('#my_first_dialog').dialog(); // hides your div and gives it the dialog attributes 
  //add in a listener so it knows when  to open your dialog 

  $('#diag_button').live('click',function(){
      if(open == 'no'){
         $('#my_first_dialog').dialog('open'); //opens your dialog
         open = 'yes'; 
      } 
      else{
         $('#my_first_dialog').dialog('close'); //closes your dialog
       }

   });
</script>

Now if you so choose you can get more technical, and add buttons to your dialog which could also do some action. But ill leave that up to you to look up.

you can find it here at : http://jqueryui.com/dialog/

Hope this helps! :)

That is if what your doing isnt an extra window.... to another webpage. In that case most of todays browsers put these into tabs and add the needed close and minmize buttons for the users to use anyway...

Member Avatar
Farhad.idrees
Junior Poster
102 posts since Dec 2010
Reputation Points: 1 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

@AleMonterio

I m calling popup from combobox binding

$('#cbmAppIniId').bind('change', function(e) { 
                e.preventDefault();

                var value = $(this).val();

                if(value == 'ShortList')
                {

                   $('#element_to_pop_up').bPopup();

                   }

i tried my best but pop up is not clossing..
:(

Member Avatar
AleMonteiro
Master Poster
758 posts since Aug 2010
Reputation Points: 115 [?]
Q&As Helped to Solve: 143 [?]
Skill Endorsements: 29 [?]
 
0
 

Farhad, I don't know bPopUp, so I can't help you.

But you should try the suggetion made by soapyillusion.

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article