Calendar Action


You can add a function to the calendar to execute when the onclick event is triggered on a specific day.

action function The function to execute.

The function can be customized to your own needs. To retrieve the date you need to access the element information using the calendar day ID. You can also check if an event is available for this date. myFunction(this.id); function myFunction(id) { var date = $("#" + id).data("date"); var hasEvent = $("#" + id).data("hasEvent"); }


<script type="application/javascript"> $(document).ready(function () { $("#my-calendar").zabuto_calendar({ action: function () { return myFunction(this.id, false); }, ajax: { url: "show_data.php?action=1", modal: true }, legend: [ {type: "text", label: "Special event", badge: "00"}, {type: "block", label: "Regular event"} ] }); }); function myFunction(id, fromModal) { if (fromModal) { $("#" + id + "_modal").modal("hide"); } var date = $("#" + id).data("date"); var hasEvent = $("#" + id).data("hasEvent"); if (hasEvent && !fromModal) { return false; } alert("You clicked on date " + date); return true; } </script>