title: How to close popup in jquery
body: <p>How to close opened popup when it opens based on condition.</p>
  
  <p>It looks very strange but I have requirement that based on some condition, if it becomes true popup should automatically close, How to do that? </p>
  
  <p>I had return <code>.dialog("close")</code> on <code>document.ready</code> event but it is not working. Any idea?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I found problem is there actually popup is close but again after completing ready event it is opened again. Any help?</p>