title: Jquery close event won't work after popup
body: <p>Please help me with my problem, my problem is i created a table which contains item information together with ADD,EDIT and DELETE. For example if I clicked the ADD button it will popup a dialog which contains the PHP form from other page. I used the load() function for it.
  Inside the form there's my textbox, etc... and below is OK and CANCEL button. But when i click the CANCEL it doesn't close the dialog box. I tried different approach but none of it works. </p>
  
  <p><strong>Here's my code in VIEW section(I am using Codeigniter)</strong></p>
  
  <pre><code> my button for add
   &lt;input class="classname1"  type="button" value="ADD" name="add_item"/&gt;
   .
   .
   .
   my div tag
   &lt;div id="popup" style="display: none;"&gt;&lt;/div&gt;
   .
   .
   .
   my jquery function
  
      /* FOR ADD PAGE */    
  
      $(".hero-unit input[name=add_item]").on('click',function(){
          $('#popup').load("&lt;?php echo site_url("item_controller/addNewItem/"); ?&gt;").dialog({
              title: "Add New Item",
              autoOpen: true,
              width: 450,
              modal:true,
              open: function (event, ui) { window.setTimeout(function () {
                  jQuery(document).unbind('mousedown.dialog-overlay').unbind('mouseup.dialog-overlay'); }, 100);
              },
              //if i include the close function it doesn't closing
  
          });
      });
  </code></pre>
  
  <p>My form after the button is clicked</p>
  
  <pre><code>&lt;div&gt;
    &lt;?php $attr = array('class'=&gt;'form-signin','id'=&gt;'addForm'); ?&gt;
    &lt;?php echo form_open('item_controller/insertNewItem',$attr); ?&gt;
  
      &lt;h2 class="form-signin-heading"&gt;&lt;/h2&gt;
          &lt;h5 style="font-weight: normal;"&gt;Category Name&lt;/h5&gt;
          &lt;?php
              echo "&lt;select name='categoryname' required='required'  autofocus='autofocus' &gt;";
                  echo "&lt;option value=''&gt;----------&lt;/option&gt;";
                      foreach($category as $row){
                          echo "&lt;option value='{$row['salescatname']}'&gt;{$row['salescatname']}&lt;/option&gt;";
                      }
              echo "&lt;/select&gt;";
          ?&gt;
  
          &lt;h5 style="font-weight: normal;"&gt;Brand&lt;/h5&gt;
          &lt;input type="text" class="input-block-level" placeholder="Item Brand" required="required" name="brand" value="&lt;?php echo set_value('description'); ?&gt;" /&gt;
              &lt;label style="color: red;"&gt;&lt;?php echo form_error('brand'); ?&gt;&lt;/label&gt;   
  
  
          &lt;h5 style="font-weight: normal;"&gt;Name&lt;/h5&gt;
          &lt;input type="text" class="input-block-level" placeholder="Item Name" required="required" name="name" value="&lt;?php echo set_value('description'); ?&gt;" /&gt;
              &lt;label style="color: red;"&gt;&lt;?php echo form_error('name'); ?&gt;&lt;/label&gt;
  
          &lt;h5 style="font-weight: normal;"&gt;Description&lt;/h5&gt;
          &lt;input type="text" class="input-block-level" placeholder="Description" required="required" name="description" value="&lt;?php echo set_value('description'); ?&gt;" /&gt;
              &lt;label style="color: red;"&gt;&lt;?php echo form_error('description'); ?&gt;&lt;/label&gt;
  
          &lt;h5 style="font-weight: normal;"&gt;Unit&lt;/h5&gt;
          &lt;input type="text" class="input-block-level" size="10" placeholder="Item Unit" required="required" name="unit" value="&lt;?php echo set_value('description'); ?&gt;" /&gt;
              &lt;label style="color: red;"&gt;&lt;?php echo form_error('unit'); ?&gt;&lt;/label&gt;
  
  
          &lt;h5 style="font-weight: normal;"&gt;Code:&lt;/h5&gt;
          &lt;input type="text" class="input-block-level" placeholder="Item Code" required="required" name="code" value="&lt;?php echo set_value('name'); ?&gt;"/&gt;
              &lt;label style="color: red;"&gt;&lt;?php echo form_error('code'); ?&gt;&lt;/label&gt;
  
          &lt;br /&gt;
          &lt;div align="right"&gt;
              &lt;input type="submit" value="OK" class="btn btn-large btn-primary" /&gt;
              &lt;input type="button" value="CANCEL" class="btn btn-large btn-primary" name='cancel' /&gt;//HERE'S THE BUTTON CANCEL. WHAT SHOULD I DO TO CLOSE THIS DIALOG?
  
          &lt;/div&gt;
    &lt;?php echo form_close(); ?&gt;
  </code></pre>
  
  <p></p>
  
  <p>Thats' all guys hope you can help me. Thanks.</p>