You need to sign in to do that
Don't have an account?
FastSnail
How can I use custom labels in external javascript file?
Custom labels are accessible in JS when script is embedded in page. Below works fine
<apex:page>
<script>
$(document).ready(function(){
alert('{!$Label.myLabel}'); ///Displays 'myLabel content' just fine
});
<script>
</apex:page>
I want to externalize the javascript to an external file:
<apex:page>
<script src="https://www.ccnus.org/various/jquery/jquery-1.11.1.min.js"></script>
<script src="https://www.ccnus.org/........./myexternal.js" ></script>
</apex:page>
Myexternal.js :
$(document).ready(function(){
alert('{!$Label.myLabel}'); ///renders {!$Label.myLabel} rather than myLabel content
});
I have tried everything I could think of. No aval. How do you get it to work?
Thanks in advance for your help,
Jerome
<apex:page>
<script>
$(document).ready(function(){
alert('{!$Label.myLabel}'); ///Displays 'myLabel content' just fine
});
<script>
</apex:page>
I want to externalize the javascript to an external file:
<apex:page>
<script src="https://www.ccnus.org/various/jquery/jquery-1.11.1.min.js"></script>
<script src="https://www.ccnus.org/........./myexternal.js" ></script>
</apex:page>
Myexternal.js :
$(document).ready(function(){
alert('{!$Label.myLabel}'); ///renders {!$Label.myLabel} rather than myLabel content
});
I have tried everything I could think of. No aval. How do you get it to work?
Thanks in advance for your help,
Jerome
Please follow the below steps: Hope now you are able to access the Custom Label in your Javascript file.
Thanks
Satya.
All Answers
Please follow the below steps: Hope now you are able to access the Custom Label in your Javascript file.
Thanks
Satya.
Best regards,
Jerome