4 answers
<apex:page controller="i20TemplateApex"> <apex:form id="theForm"> <script> function getIdOfFields(){ var richTextAreaSHowValue = document.getElementById('richTextArea'); console.log('richTextAreaSHowValue='+richTextAreaSHowValue); richTextAreaSHowValue.value=inputValue; var richTextAreaSHowValue1 = document.getElementById('{!$Component.theForm.richTextArea}'); console.log('richTextAreaSHowValue1='+richTextAreaSHowValue1); richTextAreaSHowValue1.value=inputValue; } </script> <apex:pageBlock title="Select Object and Fields" id="pageBlockId"> <apex:pageBlockSection title="Select an Object" columns="1"> <apex:pageBlockSectionItem id="pbsRichtextArea" > <apex:inputtextarea label="RichText" id="richTextArea" richtext="true" cols="100" rows="15"/> <apex:commandButton value="Insert Field" id="insertFieldButton" onclick="getIdOfFields()"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> </apex:pageBlock></apex:form></apex:page>Getting richTextAreaSHowValue & richTextAreaSHowValue1 as null