function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

External javascript files using Expressions



We're trying to optimize the use of javascript and visualforce pages and we decided to move all the code to different javascript files. The problem is, if I have something like this:





This is just an example, where I'm printing the name of an SObject


The problem is with the expression between {! }. If we store this code in a .js file and we put it in a Static Resource the expression is never being compiled. Is there a way to organize our code without having to hardcode all the javascript code in the VisualForce pages?


Thanks! :)



Hi Recard,

Instead of using expressions inside external JS file, it would be recommended to use the arguments in methods instead.