the below script doenst work unless the page is in edit mode..how can I resolve this ? I have it put on a CEWP underneath the sharepoint calendar it is handling
the goal of the script is to have the title displayed on the calendar cells as hyperlinks, open the display form in a dialog form instead of that:
<script src="https://stackoverflow.com/jquery-1.9.1.js"></script>
<script type="text/javascript">
function openDialogBox(Url)
{
var ModalDialogOptions = { url:Url, width: 600, height: 500, showClose: true, allowMaximize: true};
SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', ModalDialogOptions);
}
$('.ms-acal-month').ready(function () {
setTimeout(function() {
$('a[href*="DispForm.aspx"]').each(function() {
$(this).attr('onclick', 'openDialogBox("' + $(this).attr('href') + '")');
//$(this).attr('onclick', ' ');
//alert($(this).attr('href'));
});
$('a[href*="DispForm.aspx"]').each(function() {
$(this).attr('href','javascript:openDialogBox("' + $(this).attr('href') + '")');
});
}, 3000);
});
</script>