You need to use the simbol # before the name of ID. $( "#myDiv" ).css('left', '150px');
On Wed, May 6, 2009 at 22:22, ace jquery <acejqu...@gmail.com> wrote: > Hi there, > > I am trying to move the div object, but it seems doesn't work. any ideas? > Thanks > > <script language="javascript"> > > > > > $(document).ready(function () { > > > > $("<div/>" ) > .attr( "id", "myDiv") > > > > .addClass( "header" ) > > > > .html( "hello world") > > > > .appendTo( $( "body" ) ); > > > > > $( "myDiv" ).css('left', '150px'); > > > > }); > </script> > >