Home JAVASCRIPT Pass the Picklist value in Javascript Onchange using Visualforce page

Pass the Picklist value in Javascript Onchange using Visualforce page

Visualforce page use the below codes:

<apex:inputField value=”{!Account.Status}”  onchange=”foo(this.id);” id=”AccStatus”/>

Even better approach will be to send current element to JavaScript function rather than passing only id & then finding same element.

<apex:inputField value=”{!Account.Status}”  onchange=”foo(this);” id=”AccStatus”/>

Javascript Function
function foo(data){
alert(“Call came “);//this is displyed
alert(‘********The field value is ********’+data.value);
}

You may also like

Leave a Comment