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.
<javascript>
$(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();
});
</javascript>
<html>
<button id="addButton" rel="#addWeightsPopup" onclick="addButton_onClick();" class="modalInput StdButton">Add</button>
<div id="addWeightsPopup" class="modal addWeights">
<span>Sample Text</span>
<div class="addWeightsButton">
<button class="StdButton stdButton" type="submit" id="weightedTemplateAddButton">Save</button>
<button class="close StdButton stdButton">Cancel</button>
</div>
</div>
</html>
Actually found the answer….
triggers.eq(0).overlay().close()
0 – index of the button
So if you have two buttons, then
triggers.eq(1).overlay().close()