Platform: SharePoint 2016
I am trying to use SharePoint's pop-up modal in SharePoint 2016 but it worked once and after a few minutes it stopped. I get the following error 'OpenPopUpPageWithTitle' is undefined
Any ideas what could be wrong?
Here's the code:
$(document).ready(function() {
SP.SOD.executeFunc('sp.js', myPopUp());
});
function myPopUp() {
var lsDate = localStorage.getItem("lastConnected");
var tDate = new Date().toDateString().substring(4);
if ((lsDate == null || lsDate == undefined) || (lsDate != tDate)) {
showPopup();
localStorage.setItem("lastConnected", tDate);
}
}
function showPopup() {
var url = "/SiteAssets/popup/my-Popup.html";
var width = 680;
var height = 470;
OpenPopUpPageWithTitle(url, function(){return}, width, height, "Attention");
}
Thanks!