2

In a WebView on the Android platform, is it possible to listen to when a div that is marked with contenteditable=true is edited?

If it is not possible, what would be my next best option?

NickLH
  • 2,643
  • 17
  • 28

1 Answers1

2

Do you own the web page loaded in the WebView?

Javascript runs in the WebView can interact with the host Android app (see this guide), and it seems that the listening can be done in javascript (see this), so if you can modify the web page and add a callback to Android java code then it can be done.

Community
  • 1
  • 1
Ziteng Chen
  • 1,959
  • 13
  • 13
  • Thanks, and yes, I do own the web page. The javascript you proposed didn't do exactly what I wanted but it lead me to find this : http://stackoverflow.com/questions/4979738/fire-jquery-event-on-div-change which works great. – NickLH Oct 12 '12 at 05:54
  • @NickLH Can I ask you how you exactly implemented it in the end (if you still remember)? – papafe Nov 21 '15 at 18:28
  • If you follow the link in my previous message you will see the following code: $('#myDiv').bind('DOMNodeInserted DOMNodeRemoved', function(event) That was enough for it to work for me. If you need something more complicated then this might not be enough... – NickLH Nov 22 '15 at 21:12