On Mon, 21 Jul 2014 09:50:01 -0300, Thiago H de Paula Figueiredo
<thiag...@gmail.com> wrote:
F.ex. I have an Element which is<div>my text content</div>I create a
new Element with same name and attributes, and the new element ends up
being<div></div>but I don't know how to set the text content in it. Can
it be done ?
And here's the answer I gave you.
String newText = ...;
element.removeChildren():
element.text(newText);
Ooops, I don't think I've understood your paragraph above, so the solution
above isn't good. If your starting point is <div>my text content</div> and
the desired result is <div><div>new content</div></div> and 'element' is a
variable containing the original <div>, here's what you need to do:
element.removeChildren(); // removes everything inside the outer div
Element inner = element.element("div"); // creates a div inside the outer
div
inner.text("new content"); // adds text to it. as the inner div had no
content, adding text is the same as setting the text
There's no setText(String) method in Tapestry's element as similar ones
exist in jQuery and Prototype. On the other hand, if you clear the
elements content and then add text to it, the end result is the same.
--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org