Issues with Scripting in Cards

I was trying to make dynamic cards with a script tag in the cards markup, but whenever I pressed the edit card button, the JS would run correctly once and the second I edit anything it would refresh and completely ignore the script.

I was wondering if there was a way to make it so the JS updates when I edit it rather than closing and reloading every time; or if I am just doing something completely wrong.

Thanks in advance! slight_smile:

Try enclosing your script in a function, like this:

3 Likes

Thanks that did the trick. So basically, defining any variables out side of a local scope causes it to not update with each edit.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.