How to detect if repeater sub-element was clicked

Hi,

I have a repeater that has several control (buttons, text and images) contained within it. When either the repeater is clicked or one of the elements within the repeater is clicked, I want to take some action in the repeater element onclick event. This is all good.

The catch (at least for me), is that there’s one control within the repeater elements where I don’t want the onclick event to do anything. So, if that particular control is clicked, I want to either (a) cancel the onclick event for the repeater or (b) detect in the repeater onclick that this specific control (a text box on each repeater element) was clicked and return immediately from the parent repeater onclick event without doing anything.

No clue! All suggestions gratefully received.

Many thanks,
Gary.

Hi Gary,
Could you please elaborate on the way you’ve implemented the onClick events?
on it’s own a repeater doesn’t have an onClick event, You might have implemented a container’s onClick event(if you wrapped your repeater in one).
A simple solution would be to use a global variable to act as a flag to indicate whether or not the specific element was clicked.
The specific element onClick event would then alter the value of the flag. you can check the value of the flag in the other element onClick event inside an if statement.

for example:

let flag = false //flag initial value

export function someElement_click(event){
flag = true; //element was clicked
}

export function otherElement_click(event){
if(!flag){
flag = false //reset the flag for future uses
your site logic
}

let me know if this helped.

Thanks for your response.

Essentially I’m looking to do the following in the repeater panel onclick event as follows:

export function featurePanel_onclick(event) {

//if “read more” text box on featurePanel was clicked, return without doing anything

//else perform a number of operations as part of handling the onclick event

}

The ‘featurePanel’ element that I’m handling the onclick event for is an individual item within the gimme5Repeater itself. The “Read More” is a text box on each element. So in the picture below, each colored box is a ‘featurePanel’

The difficult I have is determining, within the featurePanel onClick event, whether it was the “read more” text element on the panel that as clicked or some other area of (or control within) the panel.

I thought about the global variable approach, which could be set in the onClick event of the “read more” text box itself. BUT, can I guarantee this will be called before the featurePanel onClick event, i.e. are events always handled in the same order?

Thanks in advance,
Gary.