Could you not just use .eq(0) to get the first style node and append to that?
Flesler wrote: > And that worked? if you have more than one style node, you would be > appending that to more than one, causing some overhead. > You could try this: > > var $style = $('#my_style'); > > if( $style.length == 0 ) > $style = $('<style>').attr('type','text/ > css').attr('id','my_style').appendTo('head'); > > $style.text(".siteWidth{width: " + modifiedW +"}");//add 'px' if > modifiedW lacks it >