Hello! After 3 days of trying and no previous code-writing experience, I managed to install ‘Read more/ Read less’ buttons. Then I transferred all this into German ‘Mehr lesen’, where I could simply translate what it says on the button. However, I have no access in the editor to translate the ‘Read less’ Button, and the code just has it in English anyway, even in the German version… Any suggestions how I can access the ‘Read Less’ button for translation?
Many thanks! Jaya
let fullText; // variable to hold the full text
let shortText; // variable to hold the short version of the text
$w.onReady( function () {
// how many characters to include in the shortened version
const shortTextLength = 695; // you can change this number
// read the full text and store it in the fullText variable
fullText = $w(“#text17”).text;
// grab the number of characters defined in shortTextLength and store them in the shortText variable
shortText = fullText.substr(0, shortTextLength) + “…”;
// set the contents of the text element to be the short text
$w(“#text17”).text = shortText;
});
export function button15_click(event) {
// display the full text
// check the contents of the text element
if ($w(“#text17”).text === shortText) {
// if currently displaying short text, display the full text
$w(“#text17”).text = fullText;
$w(“#button15”).label = “Read less”;
} else {
// if currently displaying full text, display the short text
$w(“#text17”).text = shortText;
$w(“#button15”).label = “Read more”;
}