function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Hugo BaiaHugo Baia 

inputTextarea isn't firing the event onchange

My inputTextarea with richText enabled isn't firing events. However, if the richText is disabled the event works.
 
<apex:inputTextarea onchange="change()" richText="true" value="{!content}"/>

<script>
                function change() {
                    console.log('changed');
                }
</script>

How can I solve this?
Best Answer chosen by Hugo Baia
Sandeep WaliaSandeep Walia
Hi Hugo,

Found this little trick here (https://salesforce.stackexchange.com/questions/111809/javascript-actions-such-as-onmouseout-and-onclick-not-working-for-apexinputtext)

Here is the updated code:
<apex:inputTextarea onchange="change()" richText="true"/>
    <script>
   for (var i in CKEDITOR.instances) {
        CKEDITOR.instances[i].on('change', function() {console.log('changed');});
    }

   </script>

Here is the output in the console:
User-added image

Hope this helps,
Sandeep

All Answers

Sandeep WaliaSandeep Walia
Hi Hugo,

Found this little trick here (https://salesforce.stackexchange.com/questions/111809/javascript-actions-such-as-onmouseout-and-onclick-not-working-for-apexinputtext)

Here is the updated code:
<apex:inputTextarea onchange="change()" richText="true"/>
    <script>
   for (var i in CKEDITOR.instances) {
        CKEDITOR.instances[i].on('change', function() {console.log('changed');});
    }

   </script>

Here is the output in the console:
User-added image

Hope this helps,
Sandeep
This was selected as the best answer
Hema Vijayaragavan 7Hema Vijayaragavan 7
Hi Sandeep, I tried your solution to call javascript function from inputtextarea tag, but it didnt work.  I tried many different ways.  Any idea?