Rich-text Reply

Cannot label right element

Petr 01-21-16

Cannot label right element

Hi guys,

I have a problem with selecting right element while testing CTA button. It happens on URL https://www.plnapenezenka.cz/obchody/zoot-cz where is CTA button with label "Přejít do obchodu". When I change this text, it will automatically change two other labels in main menu. I have tried to add id="CTA-test" to this element but it wouldn't help.

Do you have any ideas?

Level 1

Joel_Balmer 01-21-16
 

Re: Cannot label right element

[ Edited ]

Hi @Petr, are you referring to the big(gest) "Přejít do obchodu" CTA at the top?

 

If so, when I look at this element: 

 

$('body > main > div > section > div > article > div.col-sm-12')

 

 It has 3 childen, two of these are <a> tags that have the 'TestCTR' as their ID, so if you try to target one of these it appears to be picking up the first one which isn't actually the CTA on screen. Firstly, it's best practice to only ever have 1 element with a unique id attribute (you can use class instea of id for more than 1 element). To solve, you can force the full css selector by removing the id attribute, which works out to be this:

 

$('body > main > div > section > div > article > div.col-sm-12 > a.col-sm-4.more-main-art.show-popover.showRedirectPopup.hidden-xs.hidden-sm')

 

You can then change the text of this by adding:

 

.text('example text');

 

To the above code.

 

That should target the right CTA for you! If not, would you be able to post more details on exactly which element you're trying to change, and what change you're trying to make? Hopefully someone will be able to help you out with that extra info.

 

Thanks!