You need to sign in to do that
Don't have an account?
External javascript files using Expressions
Hi,
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:
alert('{!$ObjectType.Custom_Object__c.Name}');
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.