Unable to show hidden text on repeater

I am using below code to show / highlight an item on repeater. It’s a quiz page and explanation should be visible using below line once user click on “Show Answer” button. This is working fine in Preview mode however not working after publishing the site. I tried with box element as well and that’s also having same issue.

You can see the live page here . The explanation should be visible below “Show Answer” button.

Line number 5:

$item("#textanswer").show(); //this is working in preview mode only

Other code with in Switch statement is working fine in both preview and live mode.


export function buttonshowanswer_click(event) {

 const itemClicked = event.context.itemId;

     $w("#repeater1").forEachItem( ($item, itemData, index) => {
 if (itemData._id === itemClicked) {
 
               $item("#textanswer").show();  //This line does not work
 
 let choice = ($item("#textcorrectchoice").text)
 // console.log(choice)

 switch (choice) {
 case "A":
                         $item('#boxA').style.backgroundColor = "rgba(0,255,0,0.5)"
 break;
 case "B":
                         $item('#boxB').style.backgroundColor = "rgba(0,255,0,0.5)"
 break;
 case "C":
                         $item('#boxC').style.backgroundColor = "rgba(0,255,0,0.5)"
 break;
 case "D":
                         $item('#boxD').style.backgroundColor = "rgba(0,255,0,0.5)"
 break;
 default:
 break;
                    }

        }
     });
}

The issue was fixed by Wix support. They informed there was an issue how codes are rendered in live site. However, I started facing similar issue again after making some changes in the site. Again the code is working fine in Preview however it’s not working as expected in live site. Please note that it was working fine till few hours back. This seems to be an issue at Wix which should be rectified on priority.

The following code must be inside the $w.onReady(){} block.

$w("#dataset1").onReady(function () {
	   //  $w("#dropdown1").selectedIndex = 1
        //  $w("#repeater1").show();
        //  console.log("Dataset1 On ready - dataset1 ready")
		
});

Currently it’s outside.
So either move it to the $w.onReady block or delete it completely.

@jonatandor35 The code you mentioned are disabled. The same line already added in $w.onready function.

@equebal you’re still having it outside the $w.onReady() and this is an error that kills your code.

Thanks. I will remove this and check again.

@jonatandor35 Thanks. I will remove this and check again.

@jonatandor35 I updated the code as per your advise and it’s working fine now. Thanks for your help.