Copying value of a variable from one to another in VF page using Java Script

The VF page would be like this



<apex:form id="form">



<apex:pageBlock id="PageBlock1" >

<apex:pageBlockSection id="PageBlockSection1" >

<apex:outputField id="variableToGetValue" 

value="{!CUSTOM_OBJ__C.CUSTOM_FEILD__C}" />

</apex:pageBlockSection>

</apex:pageBlock> 

</apex:form> 


The Java function would be like this

function JAVAfunction() {

var variableToBeCopied=j$("[id$='variable']").val();

document.getElementById

("{!$Component.form.PageBlock1.PageBlockSection1.variableToGetValue}").

value=variableToBeCopied;

}






























Comments