getCurrentItem() not giving the correct item from the repeater

I have a dataset connected to a repeater. It isn’t providing the right item with onClick() and getCurrentItem(). It always seems to be giving the first item in the displayed repeater from the dataset. Any ideas why? I have used similar code another website, and it works.

Hello from the Wix DevRel Team!

I’m not sure why this isn’t working, but the fact that it’s displaying the first item in the repeater makes me think that you’re on the right track. How do you have the onClick() function set up? Can you provide your code here?

Thanks

Rob

It won’t keep the name of my button when I past in the code. But my button name is named in actual code.

The above code is what gives me the first record of the repeater.

The first thing that jumps out at me is that you’re assigning a variable with a $, I would just use let item = event.context and then change the other instances of $item to just item. Does that help anything?

Rob

Thank you, Rob. I was able to get it working!