Collapse not working in live


I’m trying to collapse a container on load using the .collapse() function within onReady(). It works fine in preview but not in the live site. Clicking the “Collapsed on load” button does work but I would have thought that it should also work via code.

Any thoughts? Thanks

Can you share your code?

See below. The two .collapse() functions below work in preview but not live.


import wixData from ‘wix-data’ ;
import wixUsers from ‘wix-users’ ;
import wixLocation from ‘wix-location’ ;
import wixWindow from ‘wix-window’ ;


// Get the user ID which was created for the new member
let userId;
let user;

$w.onReady( function () {

//Don’t show these section initially.
$w( “#moreInfo” ).collapse();
$w( “#moreInfo2” ).collapse();

// Run the main function to update the page.
$w( “#dynamicDataset” ).onReady(() => {

    $w( "#dataset1" ).onReady(() => { 

        user = wixUsers.currentUser; 
        userId =; 




Sorry for the late response.
I tried to perform the same operation and everything works properly.
Try creating new sections and Collapse them.
It is possible that something was destroyed in these Sections specifically.