B
B
brb22020-05-29 13:33:10
JavaScript
brb2, 2020-05-29 13:33:10

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

1 answer(s)
M
Maxim Lambov, 2020-07-05
@maxilamb

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 question

Ask a Question

731 491 924 answers to any question