I have a requirement to add a class to a p-tag if it has an a-tag child, like this:
<p class="read-more-link">
<a href="#">Link</a>
</p>
I've tried the following without success (this is C# in EPiServer):
new {title="Read more link", selector="p", classes="read-more-link" } // this allows user to add class to any p
new {title="Read more link", selector="p > a", classes="read-more-link" } // this adds class to a tag
new {title="Read more link", selector="p > a", classes="read-more-link", wrapper="true" } // this does nothing
new {title="Read more link", selector="p > a", block="p", classes="read-more-link", wrapper="true" } // this does nothing
new {title="Read more link", selector="a", block="p", classes="read-more-link", wrapper="true" } // this does nothing
Anyone know how to solve this?
You should be using a wrapper, see https://www.tiny.cloud/docs/configure/content-formatting/#wrapper
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With