In a perfect world: yes.

My situation is as follows: only about 1% of my sites visitors would
use a feature that requires thickbox, so i load it's js and css only
on demand.


On Aug 11, 4:46 pm, "Andy Horsman" <[EMAIL PROTECTED]> wrote:
> Honestly I think a cleaner way of doing this is have the CSS styles outside
> the javascript code and then use addClass
>
> On Mon, Aug 11, 2008 at 9:58 AM, Mike Alsup <[EMAIL PROTECTED]> wrote:
>
> > > I am trying to load css dynamically to the document by jquery.
> > > It works in firefox fine, but not in IE.
> > > any idea?
>
> > > code:
>
> > > $("<link>").attr({"rel":"stylesheet","type":"text/
> > > css","href":css_href,
> > > "media":"screen"}).appendTo(document.getElementsByTagName("head")[0]);
>
> > var head = document.getElementsByTagName('head')[0];
> > $(document.createElement('link'))
> >    .attr({type: 'text/css', href: css_href, rel: 'stylesheet, media:
> > 'screen''})
> >    .appendTo(head);
>
> > Note that this code assumes the presence of a head element.  Ideally
> > you'd make this a bit more defensive and create that element if it
> > doesn't exist.

Reply via email to