This is a code snippet to add stylesheets to DOM dynamically using javascript.
// Add stylesheets to DOM by creating a link tag dynamically.
// @param {String} url The stylesheet url.
var hookLinks = function(url) {
var link = $('<link>');
link.attr({
type: 'text/css',
rel: 'stylesheet',
href: url
});
$('head').append(link);
};
// usage eg:
hookLinks('url/to/stylesheet.css');