Hi,
I have an html element on page inside which I am running a js. The js has a variable which takes value from db. The code inside HTML is given below
When I run this page i get the following error.
“run_debug.js:592 Bug in custom html:
SyntaxError: Identifier ‘winSliderMsg’ has already been declared”
The error doesn’t appear on first page load but occurs only when i refresh the page. I haven’t declared this variable again. Also, if I assign a simple string to the variable like
let winSliderMsg =“test msg”;
the error disappears.
Any idea of why this is happening?
I think you forgot to paste the code.
1 Like
the code is executed multiple times by bubble (e.g. when the dynamic data you use changes) so your code needs to be ready for that. this is a pattern that can be useful.
on a side note including user-generated dynamic data in a string that is then evaluated as javascript (it’s what is done with scripts in html elements) is a security risk.
1 Like
system
Closed
4
This topic was automatically closed after 70 days. New replies are no longer allowed.