tElementById('id').value Not Working For Apex:outputtext ...

Skip to content

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 [email protected]

Related posts:

  1. Salesforce | How to prevent double click on Apex button
  2. How to create a dynamic div using Javascript
  3. Salesforce | Using Javascript to set value in parent Visualforce page field
  4. Salesforce | How to call apex method using Javascript
  1. Thanks, it works for me.

    Reply
  2. Pingback: 【Visualforce】JavascriptからgetElementByIdで値を参照する方法 | ガワタリ.com

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment *

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

Google ad

MENU
  • Blog Home
  • Categories
    • Web Development
    • Salesforce
    • Big Data
    • Cloud
    • Database
    • PHP Frameworks
    • eLearning
    • Insurance
    • Java Frameworks
    • Linux, Windows, Mac
    • Mobile
    • Others (General)
    • Others (Technical)
    • Software Testing
    • Zoho
  • About Us
  • Contact Us
  • StudySection

Từ khóa » Visualforce Page Document.getelementbyid