I have a SP UIModal Pop-Up, in which I want show Alert to user when click on [X]. How can i do this in SPD 2013


use option property of ModalDialog dialogReturnValueCallback

var options = {
    url: "/_layouts/myPage.aspx" ,
    dialogReturnValueCallback: function (dialogResult,returnValue )
       if (dialogResult == SP.UI.DialogResult.cancel)//when user click on [X]
           alert ('popup canceled')


This code work for me :

function fAddOnCloseHandler()
    var oCloseButton = $("a[id^='DlgClose']");


    $(oCloseButton).on("click", function (event) { fyourFun(event)} );

_spBodyOnLoadFunctionNames.push( ExecuteOrDelayUntilScriptLoaded(fAddOnCloseHandler, "SP.js") );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.