我在我的HTML页面中有一个<div>
。我需要做的是,在我的入口点类中添加<ul>
元素。我从onModuleLoad功能使用下面的代码试过,在GWT中添加HTMLelement到RootPanel
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);
但我<div>
是空的/没有孩子的时候我运行它。我在这里错过了什么?
没有,你的代码运行对我很好 – Stefan