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
QuickDEVQuickDEV 

Can I use merge fields in JavaScript function

Hi,

 

Can I make use of merge fields (access merge fields) within a Javascript funtion which is present in a visualforce page? 

 

Thanks.

Best Answer chosen by Admin (Salesforce Developers) 
TehNrdTehNrd

Yes, but if the merge field values are dynamic you will need to rerender the script so that it gets the most up to date value.

 

 

<script type="text/javascript"> var myValue = '{!something}'; </script>

 

 

 

All Answers

TehNrdTehNrd

Yes, but if the merge field values are dynamic you will need to rerender the script so that it gets the most up to date value.

 

 

<script type="text/javascript"> var myValue = '{!something}'; </script>

 

 

 

This was selected as the best answer
QuickDEVQuickDEV

Hi  TehNrd, Thanks for the reply. 

 

The reason I asked is, I am facing problem passing merg field as parameter to the javascript function.

 

I posted my problem here

 

Please help me resolve this problem.

 

Appreiate your help