I'm trying to refresh the parent page of a list when closing the dialog of a list item.

enter image description here

Is there a way to achieve this with javascript somehow?

I inspected the button in the DOM and tried to write a jQuery listener for the button's class, but it did not work:

$(".ms-dlgCloseBtn").click(function() {

Advise the best way to achieve the desired functionality.


The dialogs are custom WebParts that have been attached to the list. The dialogs are launched via OOB functionality. I am not manually opening the dialog.


1 Answer 1


Your code is not working because the event is attached only to elements that are loaded into DOM. Dialog is generated dynamically.

Hence we need jQuery to attach click event to element having style ms-dlgCloseBtn whenever it gets loaded to DOM

jQuery('.ms-dlgCloseBtn').live('click',function() {
  • I have to use .on() since I am using > jQuery 1.9, but I am still not getting a response. $("body").on("click", ".ms-dlgCloseBtn", function () { alert("test"); });
    – KidBatman
    Commented Apr 22, 2015 at 21:58
  • Try jQuery('.ms-dlgCloseBtn').on('click',function() { alert('test'); }); Commented Apr 22, 2015 at 22:11
  • I am still unable to launch the alert dialog per clicking the 'x' and your solution above.
    – KidBatman
    Commented Apr 23, 2015 at 15:53
  • Can anyone out there suggest a possible server side option then?
    – KidBatman
    Commented May 4, 2015 at 18:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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