I'm working with a platform that doesn't allow me to e开发者_高级运维dit the source code. Is there a way to insert a line in the head element dynamically? Maybe something like below...
$("<link href='http://fonts.googleapis.com/css?family=News+Cycle' rel='stylesheet'>").appendTo("head")
Yes, .appendTo()
as you have it should work perfectly fine. As well as this one:
$('head').append("<link href='http://fonts.googleapis.com/css?family=News+Cycle' rel='stylesheet'>");
but here's how I would write it:
$('head').append(
$('<link/>', {
href: 'http://fonts.googleapis.com/css?family=News+Cycle',
rel: 'stylesheet'
})
);
try this one...
$("head").append("<link href='http://fonts.googleapis.com/css?family=News+Cycle' rel='stylesheet'>")
精彩评论