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.