Dynamically loading css stylesheet doesn't work on IE

Posted by pistacchio on Stack Overflow See other posts from Stack Overflow or by pistacchio
Published on 2009-07-26T16:19:42Z Indexed on 2010/05/30 23:22 UTC
Read the original article Hit count: 341

Filed under:
|
|
|

Hi,

I dynamically load a css stylesheet (with a little help from jQuery) like this:

var head = document.getElementsByTagName('head')[0];
$(document.createElement('link'))
    .attr({ type: 'text/css', href: '../../mz/mz.css', rel: 'stylesheet' })
    .appendTo(head);

This works fine in Firefox and Google Chrome, but not in IE.

Any help? Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery