Good day!
I need urgent help.
I don’t know why but even though I wrote different code for different buttons it opens the same text in full version.
Could you please to give me a piece of advice or point out my mistakes in my code.
let fullText; // variable to hold the full text
let shortText; // variable to hold the short version of the text
// За полной документацией по API, включая примеры кода, зайдите на Velo API Reference - Wix.com
$w.onReady( function () {
// how many characters to include in the shortened version
const shortTextLength = 40;
// read the full text and store it in the fullText variable
fullText = $w(“#text19”).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(“#text19”).text = shortText;
});
$w.onReady( function () {
// how many characters to include in the shortened version
const shortTextLength = 40;
// read the full text and store it in the fullText variable
fullText = $w(" #text21").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(“#text21”).text = shortText;
});
//Add your code for this event here:
export function button4_click(event) {
// display the full text
$w( “#text19”).text = fullText;
// collapse the button
$w(“#button4”).collapse();
//Add your code for this event here:
}
export function button5_click(event) {
// display the full text
$w( “#text21”).text = fullText;
// collapse the button
$w(“#button5”).collapse();
//Add your code for this event here:
}