none
JavaScript to expand all calendar events.

    Question

  • Hello. SharePoint calendar shows only 3 events per day. I would like to expand all events when page loads. Should be easy enough. Unfortunately code below does not expand all rows.  Only first row will be expanded. Obvious question is: How can I expand all rows? 

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script>

    //script editor $( document ).ready(function() { setTimeout(function(){ $("a[evtid='expand_collapse']").each(function(i){ $(this).children().click(); }); }, 2500); }); </script>




    • Edited by second guy Friday, October 14, 2016 11:00 AM
    Friday, October 14, 2016 10:59 AM

Answers

  • Hi,

    Try this.

    //script editor
            $(document).ready(function () {
                setTimeout(
                    function () {
                        if ($("a[evtid='expand_collapse']").length>0) {
                            for (i = 0; i < $("a[evtid='expand_collapse']").length;i++){
                                $($("a[evtid='expand_collapse']").get(i)).children().first().click();
                            }
                        }
                    }
                    ,2500);
            });

    Best Regards,

    Lee


    Please remember to mark the replies as an answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Tuesday, October 18, 2016 3:20 AM