Using a repeater to display limited text from a collection/database then using a show more/less button to display the remainder text.

I am by no means a coder but I can follow directions pretty well. I am having a terrible time getting this to work. Below is what I would like, a team member page with a button linked to their bio information that is already stored in a collection.

My editor page looks like this:

My error from the console is below:

Wix code SDK error: The "onItemReady" function of "repeater1" threw the following error: fullText is undefined

My Code added to the site is below:

let fullText;
let shortText;
let shortTextLength = 80
$w.onReady(function () {
$w("#repeater1").onItemReady( ($item, itemData, index) => {
fullText = itemData.description
shortText = fullText.substr(0, shortTextLength) + "...";
$item("#text41").text = shortText
});

$w("#button1").onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item("#dataset1").getCurrentItem()
if ($item("#button1").label === "Show More"){

$item("#text41").text = clickedItemData.description
$item("#button1").label = "Show Less"
} else {

fullText = clickedItemData.description
shortText = fullText.substr(0, shortTextLength) + "...";
$item("#text41").text = shortText
$item("#button1").label = "Show More"
}
});
})

When I click the button “Bio” I also get the following error:

TypeError: fullText is undefined

Full-Screen shot of console if it helps below:

I guarantee this is something so simple, but I’m just missing it completely. At least now I am getting the button to show up in the preview, but still, no data displayed from the collection. Any insight would be greatly appreciated as I’ve scoured the forums for 2 days to no avail.

It’s probably just a matter of accounting for possible empty fields in your collection:

fullText = itemData.description || '';

Does the code that I have entered logically flow to you?

@brad29242

Have a look at Nayeli (Code Queen) tutorial for limiting characters in a repeater as it might be just right for you.
https://support.totallycodable.com/en/article/limit-characters-in-a-repeater-using-wix-code
YouTube video of above tutorial
Limit Characters using Wix Code in a Repeater | Load More Button