We all know how custom labels are useful, we can use in apex/visual force/workflow formula/validation rule etc. This post is all about hot to use in java script file which is been uploaded in static resource.
In the page just add these two lines of code, which will make js file understand the custom label.
<script>
window.$Label = window.$Label || {};
$Label.CUSUTOMLABELNAME = '{!JSENCODE($Label.CUSUTOMLABELNAME )}';
</script>
In the java script file use like below
alert($Label.CUSUTOMLABELNAME );
In the page just add these two lines of code, which will make js file understand the custom label.
<script>
window.$Label = window.$Label || {};
$Label.CUSUTOMLABELNAME = '{!JSENCODE($Label.CUSUTOMLABELNAME )}';
</script>
In the java script file use like below
alert($Label.CUSUTOMLABELNAME );
No comments:
Post a Comment