Expandable text tutorial not working

Hello, I am not familiar with code, I need to know the code for expanding text as we have a few sections of the website that are quite wordy. I have followed the instructions about how to set up the expanding text boxes on the website and when I went to preview the text did not collapse.

below is the code ive added based on the instructions given, i changed the text to match the text box i want to collapse, it says to check to confirm that only 40 characters are showing in preview before proceeding to the button.

I also have no idea what an “onclick” is either, and this is needed for my button to work?

If anyone can tell me what is going on with this and what i am doing wrong that would be awesome. Here are the error codes

Keep in mind that you can only expand/collapse an entire item at a time, meaning that if you want to expand a text then it’ll be the whole text box.

Now, the first thing you want to do is create an onClick event for the button that will collapse or expand your element.

This demonstrates how to collapse your item text37 with the click of the collapse button


export function collapseButton_click(event, $w) {
$w('#text37').collapse();
 }

If you want to collapse and expand at the same time then It’ll be something like this


export function collapseButton_click(event, $w) {

Let collapsed = $w('#text37').collapsed; //Boolean

if (collapsed === true) {$w('#text37').expand(); $w('#collapseButton').label='collapse'} 

else {$w('#text37').collapse(); $w('#collapseButton').label='expand'}
}

Your event function is very important, make sure you have your opening an closing brackets and you create it the proper way, so go to the properties settings and make sure it is there