How can I go about collapsing all groups in a sharepoint list upon page load?
I tried putting the following in a script editor web part (based on this page http://www.sharepointdiary.com/2014/07/expand-collapse-all-groups-in-sharepoint-2013-list-view-jquery.html#ixzz3Re7hfmvU):
<script type="text/javascript" src="http://code.jquery.com/jquery-1.2.6.min.js"></script>
<script type="text/javascript">
$(window).load(function () {
$("img.ms-commentcollapse-icon").click();
});
</script>
But the groups still stay open after a page reload.
