Showing posts with label calendar. Show all posts
Showing posts with label calendar. Show all posts

Saturday, January 23, 2021

How to remove hyperlink from SharePoint calendar web part event?

 ExecuteOrDelayUntilScriptLoaded(removeCalendarLinks, "sp.ui.applicationpages.calendar.js");


// call the below function or append to onsuccess handler

function removeCalendarLinks() {

 $(document).ready(function() {

    $('div.ms-acal-mdiv a').each(function() {

        $(this).attr('onclick', 'return false;')

        $(this).attr('href', '#');

    });

 });

}

Tuesday, March 29, 2016

How to open a calendar item in a modal dialog?

In this below script, open a calendar item in a modal dialog

open a calendar item in a modal dialog In SharePoint
function openDialog(pageUrl) {
  var options = {
      title : "calender",
      width : 500,
      height : 400,
      url : pageUrl
  };

  SP.SOD.execute('sp.ui.dialog.js', 'SP.UI.ModalDialog.showModalDialog', options);
}

$('.ms-acal-month').ready(function () {
   setTimeout(function() {
       $('a[href*="DispForm.aspx"]').each(function() {
           $(this).attr('onclick', 'openDialog("' +  $(this).attr('href') + '")');
           $(this).attr('href','javascript:void(0)');
       });
   }, 1000);
});