Can you target each instance of a widget within a repeater using Javascript?

I’ve got a repeater for an ecommerce product category page. Each row in the repeater data contains the information for a product.

Each product is available in multiple colors, which we’re storing as separate hex values in the columns (color 1: FF0000, color2: 00FF00 etc.)

I’m able to read out these color values via Javascript in the Item.loaded interaction, by using this code in the ‘open external link’ function.

javascript:void $axure.internal(function($ax){

I know I can target a widget on the page and set its background color using the following:

document.querySelector(’[“swatch1hex”] > div’).style.background = ‘#000000’;

But, because I’m using a repeater I have multiple instances of this widget, one for each repeater item.

Is there any syntax or way to target ONLY widgets in the current repeater Item?

Thank you

There is a way to target specific widgets inside a repeater.
These posts are similar to what you’re trying to do, so they should help get you started:

1 Like