Yes Kay Selva
Yes Kay Selva

Reputation: 584

How to append script, link, and meta tags onto head using JavaScript?

I got output like below, how to append whole into the head tag using JavaScript?

<meta name="generator" content="Joomla! - Open Source Content Management" />
<title></title>
<link rel="stylesheet" href="templates/css/template.css" />
<link rel="stylesheet" href="templates/css/templatee.css" />
<style type="text/css">
    <![CDATA[
        BODY {background: #00ff00;color: rgb(0,0,255);}
    ]]>
</style>

Upvotes: 0

Views: 347

Answers (1)

user123_456
user123_456

Reputation: 5795

You can try this:

document.querySelector('head').innerHTML = "insert your code here" 

Upvotes: 1

Related Questions