I have a div
<div id="aDiv"></div>
When I try
Window.alert(RootPanel.get("aDiv").toString());
I get the element however, just after the above statement, when I
alert(document.getElementById("aDiv"));
It returns a null.
Can someone explain the discrepancies?
GWT’s javascript code is loaded into
iframe, thereforedocumentdoesn’t point to the actual root document. To access the root page in GWT’snativemethods, you should use$docinstead ofdocumentand$wndinstead ofwindow.