When any user clicks the close (X) button of the list edit form, I want to prevent closing it and to show an additional submission dialog. For this purpose I tried to remove all event handlers from this button with no luck in IE 11.

var btnClose = $("a.ms-dlgCloseBtn", parent.document);
btnClose.click(function () { showCloseDialog(); });

If I use $clearHandlers like in the code above, I get error Out of stack space. If I use $removeHandler(btnClose.get(0), "click"); instead, I get Sys.ParameterCountException: Parameter count mismatch error.

btnClose.off().find("*").off(); or btnClose.removeAttr("onclick"); also don't work.

What am I doing wrong?

1 Answer 1


I've found a workaround solution. It isn't perfect, but it works.

I've replaced an original button with a cloned one, thus all the event listeners were removed from the new button. Here is an example of my code:

var btnClose = $("a.ms-dlgCloseBtn", parent.document);
var btnConfirm = btnClose.clone();
btnConfirm.attr("class", "custom-dlgConfirmBtn").click(function () { showCloseDialog(); });

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.