JavaScript "not valid"?


#1

I’m trying to get a financial calculator running on one of our LP’s & the Script Manager is giving me fits.
The original source, invokes external JS files through < script > tags because the scripts are huge & cumbersome at best to run inline.

The problem I’m having is, when I drop the JS for the external files into the script manager, it’s reporting that one of them isn’t valid JS.

I’ve added the open/close < script ></ script > tags per the Unbounce Script Manager instructions & it looks like it’s detecting about 1/2 of the script as valid - but 1/2 way through the script it greys out & when saved, reports that the script isn’t valid.

When I run the demo locally, in a code editor or through a validator - there’s 0 reported problems, so I’m not sure what the issue is as far as the validation error goes?

Honestly, this would just be so much easier if UB allowed for folder structures to be created & external JS files to be uploaded & called via <script src= rather than trying to run them all inline but that’s for another thread.

Any insights as to why this is being reported as invalid, would be appreciated:

Filename: KJE.js

I’ve had to link to the JS file instead of pasting in ‘pre-formatted’ mode, due to character limits:
https://drive.google.com/file/d/1oXQw7YJd5fdAtZxwtO5LMi8p7kF4da36/view?usp=sharing


#2

Do you have multiple scripts in your Script Manager?

I have run into similar issues where they wouldn’t run properly. My solution was to add all of the scripts into one single variant script rather than having them separated as different variant scripts.

example variant script: “All My Page Scripts”
< script >
1 blah blah
</ script >
< script >
2 blah blah
</ script >


#3

I do have multiple scripts (relating to the same financial calc) in Script Manager. I appreciate & tried your suggestion, but it’s still showing it as invalid with the same block of code grayed out.

Wish I could get to the bottom of this, we have numerous calcs we want to run on multiple LP’s but it’s getting too time-consuming trying to figure it out. I think I’m just going to throw it up on our WP server, call it via iframe & be done with it.

I’m sure there’s a way to fix it, just as I’m sure there’s a reason they don’t let us create folders & call the scripts via < scrpt src= but…Ain’t Nobody Got Time For Dat’

Thanks again for the suggestion though, was worth a shot.