If you have an apex:outputtext and you try to get its value in Javascript using document.getElementById(‘id of outputtext’).value(), that won’t work. The reason is apex:outputtext is translated to HTML SPAN element.
So
<apex:outputtext value=”Amount” id=”amntId”/>
becomes
<span id="amtId">Amount</span>
So to get the value use innerHTML instead – document.getElementById(‘id of outputtext’).innerHTML.
Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Salesforce customization, App development or any other software development assistance please contact us at salesforce@webners.com
Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.
Thanks, it works for me.
[…] これは、apex:outputTextはspanに変換されるため、valueではなくinnerHTMLで参照する必要があるとのこと。Salesforce | document.getElementById(‘id’).value not working for apex:outputtext […]