You need to sign in to do that
Don't have an account?
Stefaan Somers 11
how to use javascript variable in visual force page
I have a visualforce page that uses a tag from a packaged component:
<cxsrec:getMapValue map="{!candidateFieldMap}" key="Specialty__c"/>
I want to do something that
If Specialty = 'Test1' then show
<div> Test 1 </div>
If Specialty = 'Test2' then show
<div> Test 2 </div>
I can try to obtain the value maybe through jquery or something, but how can I reuse this variable then afterwards in my visualforce page.
<cxsrec:getMapValue map="{!candidateFieldMap}" key="Specialty__c"/>
I want to do something that
If Specialty = 'Test1' then show
<div> Test 1 </div>
If Specialty = 'Test2' then show
<div> Test 2 </div>
I can try to obtain the value maybe through jquery or something, but how can I reuse this variable then afterwards in my visualforce page.
You can use a Visualforce expression to retrieve the value of Specialty__c, and then use it to conditionally render the div elements. Here's an example:
This code first wraps the <cxsrec:getMapValue> tag in an <apex:outputPanel>, which allows you to retrieve its text content using jQuery.
If the above information helps , please mark this as Best Answer.
Thank you.