Answer the question
In order to leave comments, you need to log in
What is the problem with JS?
There is a code that is responsible for the function of opening / closing the menu on click. Since Smarty doesn't want to process requests without {literal}, I had to add these tags, but after that the code stopped working. What is the problem?
{literal}
<script type="text/javascript">
const toggles = document.querySelectorAll('.faq-toggle');
toggles.forEach(toggle => {
toggle.addEventListener('click', () => {
toggle.parentNode.classList.toggle('active');
});
});
</script>
{/literal}
Answer the question
In order to leave comments, you need to log in
Read the documentation of your template engine!
https://www.smarty.net/docs/en/language.escaping.tpl
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question