user1226162
user1226162

Reputation: 2032

GWT: how to access/change HTML Panel's value

I have an HTML Panel , where i am saving some text and then i want to access some specific HTML Panel's node and change its attribute ,

This is what i am doing

      HTMLPanel htmlText;
      htmlText.setInnerHTML(result.getText());
      Node x  = htmlText.getChild(1);

I am getting this javascriptObject$ as the value of x (If i see in in Debug)

     <span class="my-wrapper"><span class="myText">testing text</span><span class="myNumber"> (2) </span></span>

What i need is to get only this text "testing text" and change its color.

is it possible ?

thanks

Upvotes: 1

Views: 1052

Answers (1)

logan
logan

Reputation: 3365

I think that you may want to use GWTQuery for this type of thing.

HTMLPanel htmlText;
htmlText.setInnerHTML(result.getText());
//Node x  = htmlText.getChild(1);

String value = $(".myText", htmlText).text();

Upvotes: 1

Related Questions