Problems attaching document to hyperlink on expandable text box

I’ve been having some problems the last few days with the expandable text box because it always showed some weird stuff on the preview. I managed to fix it with the tutorials here on the forum and the code is now the following:

let fullText; // variable to hold the full text
let shortText; // variable to hold the short version of the text
// For full API documentation, including code examples, visit Velo API Reference - Wix.com

$w.onReady( function () {
// how many characters to include in the shortened version
const shortTextLength = 850;
// read the full text and store it in the fullText variable
fullText = $w(“#text3”).html;
// 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(“#text3”).html = shortText;
//TODO: write your page related code here…

});

export function button1_click(event, $w) {
// check the contents of the text element
if ($w(“#text3”).html === shortText) {
// if currently displaying short text, display the full text
$w(“#text3”).html = fullText;
$w(“#button1”).label = “show less”;
} else {
// if currently displaying full text, display the short text
$w(“#text3”).html = shortText;
$w(“#button1”).label = “show more”;
}
}

The only problem that I have now is that I’m trying to attach a document to a hyperlink text, but whenever I try to do it, it messes up the text like in the following images:

Does someone know how to help me? Thanks in advance!
Vitória

Hi,

Whenever you can see HTML tags in the text, that means the html is not rendered. Try to add this line in the onReady function to render the html ( not to show them as a text ) .

$w("#textId").html = $w("#textId").text;

Hope this helps!
Best,

Mustafa