SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How to call JavaScript in SharePoint Calendar Add Button Click event ?

share|improve this question
What are you trying to do? You can hook into the button, for example with jQuery: $('[id="Ribbon.Calendar.Events.New.NewListItem-Large"]').click(function(){...})‌​ or even override the methods directly in SP.UI.ApplicationPages.CalendarMouseHandler. But this will only tell you if the modal window were opened. You could however override the whole modal – eirikb Nov 6 '12 at 6:56
$(document).ready(function () { $('.ms-acal-rootdiv').unbind("click").click(function () { .... }); }); i tried this but its not working – Rajesh Joshi Nov 6 '12 at 6:59
$('[id="Ribbon.Calendar.Events.New.NewListItem-Large"]').click(function(){...})‌‌​​ its also not working – Rajesh Joshi Nov 6 '12 at 7:02
Note that will only trigger for the large button (hence "NewListItem-Large"). You can run that in console when you see the button. document ready will not work, as the Ribbon is loaded asynchronously. – eirikb Nov 6 '12 at 7:18
up vote 1 down vote accepted

What you could do instead is to use PreSaveAction. You need to append this to the form where you save the item, and run it like this when the form is ready:

function PreSaveAction() {
  // Do work;
  return shouldSaveItem;

For example (jQuery):

$(function() {
  window.PreSaveAction = function() { return false; };
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.