Need to change add to cart image across multiple pages
I have optimizely snippet on all pages. I have setup my experiment to run across all intended pages.
Placing a couple of product pages:
In the optimizely editor I got one of the product page URL. I changed the add to cart button. In the URL target I listed all product page URL's.
Problem is other product page URL's dont have Add to Cart images changed.
Is this because each add to cart tag has a different id for each page.
I got stuck. Any help is appreciated
This looks like a common problem where the edit finds an ID, which is great for this page, but when the element IDs are product IDs, or dynamically generated, or different across pages, you will need to account for this.
From your page, it looks like you can use the class instead to target the same elements, like so:
$(".cm-submit-link > img")
This means you can make whatever changes you want to make in the editor, let the editor 'do the work' and generate the code, then once finished you can edit the selector to, instead of $("#button_cart..."), etc., just replace it with the above code.
I hope that helps!