Clicked stimuli online experiments

URL of experiment:

Description of the problem:

I am not able to record which object was clicked in an online experiment and use that to determine what is displayed next.

It seems like a simple task. Created in builder, I have a mouse component with clickable stimuli. In some code I have tried multiple ways to detect what has been clicked and then use an if statement, either with a Boolean or an index, to determine what happens on the next routine. I have tried making transparent polygons clickable and making the text clickable (the choice options). In psychopy, it works fine either way. Online, a click will end the routine, but it will not recognize what component has been clicked to update the next routine. For example, instead of updating the text based on what was clicked, it just fills it with ‘Hello World’.

I can see scattered advice and seen the emotional stroop JS example which registers where the mouse is, but I really want the clicked stimuli measure. I can’t find this particular issue on the crib sheet, which has otherwise been very helpful.

Is there a foolproof way to measure what has been clicked for JS, made within builder? The overall aim is to make this simple decision-making experiment available to phones and other touchscreens, which I think will be useful to many.

Many thanks

What have you tried so far? For example, I think mouse.clicked_name should work

However, if you end a routine with a mouse click then the contains method in End Routine will be pretty reliable since the mouse position won’t have moved.