views:

36

answers:

1

I executed but only FF and chrome moves the textarea 0px from top and 0px from left but in IE textarea is in default position.

Here is my code:

public class MyGWT implements EntryPoint {

   TextArea ta= TextArea.wrap(DOM.getElementById("t"));

   public void onModuleLoad() {

     ta.getElement().setAttribute("style", "position:absolute;top:0px;left:0px;");
   }

}

is there any bug or how can i change style attribute programmatically from GWT ??

+1  A: 

Don't set style via setAttribute. In JavaScript the style attribute is actually an array. Thus depending on how smart the browser is and understands you want to set the style attributes it will work by setting style or won't work.

You should set style attributes individually via getElement().getStyle().setProperty(). Or use the specific methods, like: ta.getElement().getStyle().setPosition(Position.ABSOLUTE) or via the setProperty method: ta.getElement().getStyle().setProperty("position", "absolute"). And the same for the 2 other properties. See the Style class for what specific methods are supported.

Hilbrand