0

I write a chrome extension where I have to act on a text-input on a website.

The input looks like a "normal" textarea, but when looking at the dom instead it contains something like this:

<div id=":5z.f" class="df b-K b-K-Xb URaP8 editable aspg-comment-textarea" 
g_editable="true" role="textbox" contenteditable="plaintext-only" dir="LTR">
The text I just entered<br>
</div>

("The text I just entered" is the text I wrote inside the textarea)

When I try to add an event to that div it does not work:

  $(document).on('change', '[role="textbox"]' ,function(){
            console.log("user entered something"); 
        }
       );

The event never seems to be accessed. My best guess would be that this is because a div has no change - event.

But how can I act on a change of the div's content?

Ole Albers
  • 8,715
  • 10
  • 73
  • 166

0 Answers0