You need to sign in to do that
Don't have an account?

How to pass the id of Selectlist value to the Javascript in Salesforce
Do anyone have idea to pass the Selectlist value to the Javascript in Salesforce using Document.Element.id .
i need to get the selected value as an alert ;;
Please let me know how can i get the values , using the javascript Element.id Only
Or provide useful links will go through it ..
using the Javascript Element only ..
Thanks
Deepika
i need to get the selected value as an alert ;;
Please let me know how can i get the values , using the javascript Element.id Only
Or provide useful links will go through it ..
<apex:page id="pg" > <apex:form id="frm"> <script> function getvalue(){ alert("hi"); var selectedvalue =document.getElementById("pg:frm:otptpanel:selectlist").value; alert(selectedvalue); } </script> <apex:outputPanel id="otptpanel" > <apex:selectList id="selectedval" size="1" onchange="getvalue()"> <apex:selectOption itemLabel="Hyderbad" itemValue="Hyd"/> <apex:selectOption itemLabel="Banglore" itemValue="Ban"/> <apex:selectOption itemLabel="Chennai" itemValue="Che"/> </apex:selectList> </apex:outputPanel> </apex:form> </apex:page>
using the Javascript Element only ..
Thanks
Deepika
Use the below changes in JS:
var selectedvalue =document.getElementById("pg:frm:selectedval").value;
alert(selectedvalue);
Thanks,
Maharajan.C
All Answers
Use the below changes in JS:
var selectedvalue =document.getElementById("pg:frm:selectedval").value;
alert(selectedvalue);
Thanks,
Maharajan.C