I have been trying for a while to edit the text within an element, but I've not had much luck finding similar examples. Those that I have found haven't worked.
The code I have at the moment is pretty much the same as shown in the Jsoup docs
Java
public void updateTitle() {
Element content = doc.body().getElementById("titleCER");
System.out.println(content); // Prints '<p class="certificate-CcM" id="titleCER">CERTIFICATE</p>'
content.text().replaceAll("text", "Change to this"); // does nothing
content.text("change to this!"); // does nothing
}
HTML
<p class="certificate-CcM" id="titleCER">CERTIFICATE</p>
Right now when the code runs, it finds the element by ID fine, but then doesn't update anything in the HTML file
Thank you for any help
I was never writing the edited Document back to the HTML file
The solution is:
where 'input' is: