CSS Selector | Community
Skip to main content
Level 2
June 23, 2023

CSS Selector

  • June 23, 2023
  • 1 reply
  • 668 views

Hi, 

Working for a company that have multiple websites.

I need to fire an event when the reader clicks on a part of the website, so I am using CSS Selector in the rule.

The thing is that I would like to use the same rule for several websites but the CSS selector I get from the code is getting the website within the code. Is there a way to replace one part of the code by something generic.

here the exampple:

#app > div > div.container-fluid.AA_com.frontpage.page-frontpage > div:nth-child(2) 

In bold the keyword that will change in each publication. Is there a way to replace this by something ? Like we do for example for this one:

div:nth-child(2)  -> div:nth-child(n)  => the 2 is replaced by n 

 

Thanks in advance if anyone can help me .

Have a nice day

Sophie

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

kautuk_sahni
Community Manager
Community Manager
October 18, 2024

@sophie_h If you have successfully found a solution on your own, we kindly ask that you share it with the community for future reference and mark it as the correct answer.

Kautuk Sahni
Sophie_HAuthor
Level 2
October 18, 2024

no solution on my end.