How can I fix my text in containers that are a part of a repeater to show unique text in each container?

This is the code I am currently using:
export function StudySummary_click_1(event, $w) {
let q = $w( ‘#StudyDescription’ );
let a = $w ( ‘#StudyDescription’ );
if (a.collapsed) {
q.text = “I” .concat(q.text.substring( 1 ));
a.expand();
}
else {
q.text = “I” .concat(q.text.substring( 1 ));
a.collapse();
}
When I click on the “Study Summary” text it should take me to a “Study Description” text that is unique to the container it is in, but now it displays the same text across all containers even though there is unique text in each container and in preview, everything functions normally. I can’t figure out how to fix this so any advice is appreciated!

You need to use the Repeated Item Scope so that you access the relevant repeater item. You should do something like this:

exportfunction StudySummary_click_1(event) {
   let $item = $w.at(event.context);
   let q = $item('#StudyDescription');
   ... the rest of your code ...

See the at() API doc for more details.

Also, variables q and a are both set to the #StudyDescription and therefore are equivalent. What are you trying to do with q and a?