Setting the text content of elements


You need to modify the text content of a HTML document.


Use the text setter methods of Element:

Element div ="div").first(); // <div></div>
div.text("five > four"); // <div>five &gt; four</div>
div.prepend("First ");
div.append(" Last");
// now: <div>First five &gt; four Last</div>


The text setter methods mirror the HTML setter methods:

The text should be supplied unencoded: characters like <, > etc will be treated as literals, not HTML.