J
J
JastaFly2021-05-28 12:34:16
1C-Bitrix
JastaFly, 2021-05-28 12:34:16

Bitrix fall off JS events on the site?

Good day to all! A number of buttons with the same handler do not work on the site . If you go to the code inspector, you can see that there are no events on these buttons:
60b0b7eb542d0847310443.jpeg
At the same time, if you clear the cache on the site, everything starts working and events are again hung on the buttons:
60b0b90ca615c137772839.jpeg
but exactly until the page is reloaded, then everything falls off again.
The handler script is cut directly in the template via Asset::getInstance()->addJs, and after the first load it stops loading.
I thought about the composite, but disabling it on the site did not lead to a correction of the situation. Pliz tell me what could be wrong?!??
Thank you all in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
BornTo FreeFall, 2021-05-28
@JastaFly

As already noted by no_one_safe - using "Asset::getInstance()->addJs" is only useful in those parts of the code that are not subject to any kind of caching. Use the component_epilog.php of your component. In the JS component itself, the code is connected using the "addExternalJs" method. Link to bitrix info Click

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question