Open Dialog Box When Clicking on Calendar Event


I added a Calendar View (week) for a list on a Site Page. When I click an event, it takes me to another page instead of opening a dialog box.


<script src="" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
setInterval(function () {
$("a[href*='DispForm.aspx']").each(function () {
$(this).attr("onclick", "openDialog('" + $(this).text() + "','" + $(this).attr("href") + "')");
$(this).attr("href", "javascript:void(0)");
}, 900);

function openDialog(title, url) {
var options = {
title: "Calendar - " + title,

url: url

Paste that into a Script Editor web part or save it as calendar.js and then call it from a Content Editor web part.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s