Auto click button on page load (CMS Combine + CMS Sort)

Hi guys,

I’m using Finsweet’s CMS Combine and CMS Sort on my homepage. I’m trying to set up a hidden button to be pressed automatically when the page loads so the button automatically sort the items by name.

The script I have on the page works, however, when browsing the site, for example, on 3-4 navigations back to the home page, it stops working and the items are no longer sorted by name.

https://jans-cool-site-758125.webflow.io/

The script I’m using is the one which Finsweet refers in their tutorials:

<script>
window.onload=function(){
document.querySelector(".fs_cmssort_button").click();
};
</script>

Can someone please take a look at it? Thanks!


Here is my site Read-Only: LINK

Did you happen to find a solution? I found the same issue.