We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,430 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

how to close popup window when close button clicked

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

3
Contributors
4
Replies
2 Hours
Discussion Span
3 Months Ago
Last Updated
13
Views
Farhad.idrees
Junior Poster
102 posts since Dec 2010
Reputation Points: 11
Solved Threads: 0
Skill Endorsements: 0

How are you oppening the popup?

AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23

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...

soapyillusion
Junior Poster in Training
88 posts since Dec 2009
Reputation Points: 10
Solved Threads: 6
Skill Endorsements: 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..
:(

Farhad.idrees
Junior Poster
102 posts since Dec 2010
Reputation Points: 11
Solved Threads: 0
Skill Endorsements: 0

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

But you should try the suggetion made by soapyillusion.

AleMonteiro
Master Poster
752 posts since Aug 2010
Reputation Points: 129
Solved Threads: 140
Skill Endorsements: 23

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0677 seconds using 2.67MB