Hi,
I am trying to add the following code with the Template Custom code, but it will not load on the front end.
<script>
document.addEventListener("DOMContentLoaded", function() {
const coll = document.querySelector(".collapsible");
const content = document.querySelector(".content");
const indicator = document.querySelector(".indicator");
if (coll && content && indicator) {
coll.addEventListener("click", function() {
if (content.style.maxHeight) {
content.style.maxHeight = null;
indicator.textContent = 'Lenyit';
} else {
content.style.maxHeight = content.scrollHeight + "px";
indicator.textContent = 'Bezár';
}
});
}
});
</script>
What could be the issue, please?
Let me know, thanks in advance.