# Trouble with Expandable Read More Text Boxes

**URL:** <https://forum.wixstudio.com/t/trouble-with-expandable-read-more-text-boxes/11965>\
**Category:** Ask the community\
**Tags:** question, code, wix-stores\
**Created:** [February 8, 2019, 7:05pm UTC](https://forum.wixstudio.com/t/trouble-with-expandable-read-more-text-boxes/11965 "2019-02-08T19:05:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstepanek3](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/cstepanek3/32/7646_2.png) [@cstepanek3](https://forum.wixstudio.com/u/cstepanek3)\
**Post date:** [February 8, 2019, 7:05pm UTC](https://forum.wixstudio.com/t/trouble-with-expandable-read-more-text-boxes/11965/1 "2019-02-08T19:05:58Z")

</div>

Hello, I would like to add 6 separate text boxes on one page. I would like to add the “read more” button to all of them so the text expands only if the button is clicked. So far, I have two boxes and I followed the instructions, including adding the code, to get the expandable text boxes.  
The first text box works OK, except for the fact that the text has links in it and when the “read more” button is added the links don’t work. But my biggest problem is that when I add the “read more” button to the second text box, both text boxes automatically have the same text, when they are supposed to say different things. Also, the font on the 2nd text box gets really, really big. It’s just completely screwed up, but if I could get these buttons to work then they would be exactly what I need.

Below is my code and a screenshot of what is going wrong.

**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 = 40;  
// read the full text and store it in the fullText variable  
fullText = $w(“#text2”).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(“#text2”).text = shortText;  
//TODO: write your page related code here…

});

// collapse the button

export function button1\_click(event) {  
// display the full text  
**if** ($w(“#text2”).text === shortText) {  
// if currently displaying short text, display the full text  
$w(“#text2”).text = fullText;  
$w(“#button1”).label = “Show less”;  
} **else** {  
// if currently displaying full text, display the short text  
$w(“#text2”).text = shortText;  
$w(“#button1”).label = “Show more”;  
}  
}

$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(“#text3”).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(“#text3”).text = shortText;  
//TODO: write your page related code here…

});

// collapse the button

export function button2\_click\_1(event) {

**if** ($w(“#text3”).text === shortText) {  
// if currently displaying short text, display the full text  
$w(“#text3”).text = fullText;  
$w(“#button2”).label = “Show less”;  
} **else** {  
// if currently displaying full text, display the short text  
$w(“#text3”).text = shortText;  
$w(“#button2”).label = “Show more”;  
}  
}

 ![](https://us1.discourse-cdn.com/wix/original/3X/d/1/d1b9e45ca4cd1c1f2ee3e9b823598546bd16b97c.png)

---

<div class="post-metadata">

**Author:** ![nicolinhedberg](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/nicolinhedberg/32/12286_2.png) [@nicolinhedberg](https://forum.wixstudio.com/u/nicolinhedberg)\
**Post date:** [May 28, 2019, 6:50am UTC](https://forum.wixstudio.com/t/trouble-with-expandable-read-more-text-boxes/11965/2 "2019-05-28T06:50:54Z")

</div>

I have the same problem. Did you get any solutions on this?

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [May 28, 2019, 11:26am UTC](https://forum.wixstudio.com/t/trouble-with-expandable-read-more-text-boxes/11965/3 "2019-05-28T11:26:26Z")

</div>

Already answered here.  
[https://www.wix.com/corvid/forum/community-discussion/multiple-expandable-boxes-with-read-more](https://www.wix.com/corvid/forum/community-discussion/multiple-expandable-boxes-with-read-more)
