Search code examples
javascriptbuttonpanelmodalpopupextender

Call javascript during modalpopup.show()


I have a javascript that disables a button for x seconds and then enables the button after x seconds pass. An update button checks for certain constraints, and if met, a modal popup is shown. The button the javascript is meant for is located in a panel displayed by this modal popup. Is there a way I can execute the javascript when the modal popup / panel is shown?


Solution

  • You can use the following approach if you want to run JavaScript code when a modal popup is showing:

    $find("myModalPopupExtender").add_showing(function() {
        alert("Modal popup will be shown.");
    });
    

    The alert will be shown each time the modal popup extender shows the popup.