Hello, I am new to web development so please bear with me if my question seems naive. I am currently working on a script using html, css, and js to display a text editor in a webView. The editor is being displayed without any issues, but now I'm facing difficulty in retrieving the content of the particular element with the id "myEditor". Can someone assist me in resolving this problem?
Here is the HTML code snippet:
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.css">
</head>
<body>
<style>
#editorContainer {
max-width: 600px;
margin: auto;
}
...
In the Java code block below, the current implementation returns the entire script of the webView. I am unsure how to modify it to only retrieve the desired result.
Java Code:
webView.evaluateJavascript(
"(function() { return ('<html>'+document.getElementsByTagName('html')[0].innerHTML+'</html>'); })();",
new ValueCallback<String>() {
@Override
public void onReceiveValue(String html) {
}
});