Add HTMLelement from entry Point class

11 views
Skip to first unread message

Vivek MS

unread,
May 27, 2012, 5:42:43 AM5/27/12
to Google Web Toolkit
I have a `<div>` in my HTML page. What I need to do is, add `<ul>`
element inside it from my Entry point class. I have tried from
onModuleLoad function using below code,

UListElement ul=Document.get().createULElement();
ImageElement img=Document.get().createImageElement();
img.setSrc("\\images\\personas");
LIElement li=Document.get().createLIElement();
li.appendChild(img);
ul.appendChild(li);
Document.get().getElementById("divPhotos").appendChild(ul);
but my `<div>` is empty/has no childs when i run it.
what am I missing here?

Joseph Lust

unread,
May 30, 2012, 4:00:18 PM5/30/12
to google-we...@googlegroups.com
Vivek,

Your code works fine for me (GWT 2.4 starter project). Not sure why it is not work for you, so I think it has to be one of the following:
  • Are you sure the code is getting run? Perhaps you can step through with break points.
  • Are you sure you have the <div id="divPhotos"><div/> in your entry HTML page? 

Sincerely,
Joseph
Reply all
Reply to author
Forward
0 new messages