Hi Yisrael,
Thanks for your helps…
I have a repeater with three static item ( for now). I need to set show more or show less for the text box that is inside each item.
the problem I am having is when I click on the show more button to show the full text of the text box, it shows the full text that is inside the last item and not the full text of the item that has been clicked…I have tried to add even handler inside the on ready function ,didnt work also I have tried to add on ready item and resisted the on click even there, still didnt work…
here is my code
can I have fullText and shortText as an array so when item is clicked the associated index gets passed?..or any other idea?
let fullText;
let shortText;
const shortTextLength = 20;
$w.onReady( function () {
$w(“#repeater1”).forEachItem( ($item, itemData, index) => {
fullText = $item(“#text14”).text;
shortText = fullText.substr(0, shortTextLength) + “…”;
$item(“#text14”).text = shortText;
} );
});
export function button1_click(event, $item) {
if ($item(“#text14”).text === shortText) {
// if currently displaying short text, display the full text
$item(“#text14”).text = fullText;
$item(“#button1”).label = “Show less”;
} else {
// if currently displaying full text, display the short text
$item(“#text14”).text = shortText;
$item(“#button1”).label = “Show more”;
}
}
Please advise…
Ella