I have override new item form for list, opening myPage.aspx where this javascript is in the "PlaceHolderAdditionalPageHead":
function fGetCloseBtn() {
var closeButton = jQuery("a[id^='DlgClose']");
console.log(closeButton.lenght);
}
function fAddScriptToQueue() {
ExecuteOrDelayUntilScriptLoaded(fGetCloseBtn, "SP.js");
};
_spBodyOnLoadFunctionNames.push("fAddScriptToQueue");
When page loaded, Log shows 0. Inspecting element in IE Dev Tools show that it exist. So, did I picked the wrong time to select element? Or has modal dialog other dependencies then SP.js?