Dear Friends while i inserted the text code below
in text it is first showing all the text then after clicking the button it is showing less but i need the opposite,First it should less then after clicking read ore button it should show all kindly help.
// For full API documentation, including code examples, visit Velo API Reference - Wix.com
let fullText;
let shortText;
let shortTextLength = 50
$w.onReady( function () {
$w(“#repeater2”).onItemReady( ($item, itemData, index) => {
fullText = itemData.description
shortText = fullText.substr(0, shortTextLength) + “…”;
$item(“#description”).text = shortText
});
$w(“#button1”).onClick( (event) => {
let $item = $w.at(event.context);
let clickedItemData = $item(“#dataset1”).getCurrentItem()
if ($item(“#button1”).label === “Show More”){
$item(“#description”).text = clickedItemData.description
$item(“#button1”).label = “Show Less”
} else {
fullText = clickedItemData.description
shortText = fullText.substr(0, shortTextLength) + “…”;
$item(“#description”).text = shortText
$item(“#button1”).label = “Show More”
}
});
})