adding style to an element using jquery
lets say you had this div structure <div id="main"> <div class="sub"> Content for the sub div </div> </div> you want to set main to relative and sub to absolute correct ? <script> $(function() { $("#main").css({ position:"relative", top:"0", left:"0")}; $(".sub").css({ position:"absolute", top:"30%", left:"40%")}; }); </script> did you mean something else ? On Tue, May 12, 2009 at 2:37 PM, Mean Mike <mcgra...@gmail.com> wrote: > > Ash, > > All your design should be done in CSS at least thats my understanding > of how you design a web site. > > a quick google got me this article which shows how to set style with > jquery > > http://ajax.phpmagazine.net/2006/04/event_selector_showdown_the_jq.html > > here is the documentation for jquery's css http://docs.jquery.com/CSS > > > personally I would try to do all me css in a css file and have jquery > switch the class as needed > > Mike > > On May 11, 5:11 pm, "ash.finlay...@googlemail.com" > <ash.finlay...@googlemail.com> wrote: > > Hi All > > > > I am just moving over to jquery. Previously i had been using prototype > > and scriptaculous, im trying to figure out how to set a div relative > > to another div. in prototype i would of used 'setStyle' to do this. > > Can anyone give me an example of how to do the same in jquery? > > > > Many Thanks > > Ash >