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

How are you oppening the popup?

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

@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, I don't know bPopUp, so I can't help you.

But you should try the suggetion made by soapyillusion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.