Hey guys, I was wondering if it is possible to captalize every first letter of a word inside of an accordion.
I'm already using a custom CSS for my font,weight, and captalize the first letter inside of the accordion, but it only captalize the first letter of a word after a paragraph.
div.accordion-item__dropdown p {
font-family: Adobe Garamond Pro Regular !important;
font-weight: 500;
text-transform:lowercase;
text-transform: capitalize first letter;
letter-spacing: 0.5px
}
p::first-letter {
text-transform: capitalize;
}
div.accordion-item__dropdown * {
font-size: 18px !important;
}
I attach a file that illustrate what is happening.
I tried to put this code into the code injection, inside of the footer:
<script>
document.addEventListener("DOMContentLoaded", function() {
var accordionDescriptions = document.querySelectorAll(".sqs-block-accordion .sqs-block-content");
accordionDescriptions.forEach(function(description) {
description.innerHTML = capitalizeAfterPeriods(description.innerHTML);
});
});
function capitalizeAfterPeriods(text) {
return text.replace(/\. [a-z]/g, function(match) {
return match.toUpperCase();
});
}
</script>
If someone can help me! Thank you!!