title: JQuery overlay close
body: <p>hi I have got the following code and I want to close this overlay popup once the save has been completed. HTML section displays the html code block I have and Javascript block explains how I'm trying to call this overlay.</p>
  
  <pre><code>&lt;javascript&gt;
  
  $(document).ready(function() {
  
      var triggers = $(".modalInput").overlay({
          closeOnClick: false
      });
  
  
  var weightedTemplateButtons = $("#addWeightsPopup button").click(function(e) {
  
          var save = weightedTemplateButtons.index(this) === 0;
  
          if (save) {
              if (validateWeightedTemplate()) {
                  completeWeightedTemplate();
                  addNewWeightedTemplate();
  
                                     /*this doesn't work*/
                  weightedTemplateButtons.overlay().close();
  
              }
          }
  
          return e.preventDefault();
      });
  
  &lt;/javascript&gt;
  
  &lt;html&gt;
  
  &lt;button id="addButton" rel="#addWeightsPopup" onclick="addButton_onClick();" class="modalInput StdButton"&gt;Add&lt;/button&gt;
  
  
  &lt;div id="addWeightsPopup" class="modal addWeights"&gt;
    &lt;span&gt;Sample Text&lt;/span&gt;
      &lt;div class="addWeightsButton"&gt;
         &lt;button class="StdButton stdButton" type="submit"  id="weightedTemplateAddButton"&gt;Save&lt;/button&gt;
         &lt;button class="close StdButton stdButton"&gt;Cancel&lt;/button&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/html&gt;
  </code></pre>