Repeaters and Buttons On Click

Hi,

I have a repeater. The container inside the repeater has an “on click” event trigger which takes you to another page based on the individual item. The container also has a button which changes colour with an “on click” event. Both of these events are working correctly, however, both events trigger when the button is clicked, I suppose because the container is technically being clicked at the same time. Is there a way to stop the container’s “on click” event from triggering when trying to click the button?

ie. If the button is clicked, then the button should change colour, but the user should not be redirected to a new page. However, if ANY other section of the container apart from the button is clicked, the user should be redirected to the new page.

Any help solving this would be greatly appreciated!

Hey
The basic answer here would be, do not use an onClick event on the container itself. If you must have a click event that is big and covers the items add a transparent box to the item and then move your button to stay on top of that newly added box, then the box click event won’t trigger when you click the button.

Thanks so much! That works perfectly.

@whope Please mark my answer as Top Comment if you like it, it will help me.

@andreas-kviby Done! Thanks again for the help.