I am trying to add a script to the head tag of my page. I am seeing the code that I am trying to add in the body tag but it doesn't show up in head tag.
$(document).load(function() {
$('<script>console.log("hi");</' + 'script>').appendTo("head")
});
I see this being added in <body>
but I dont see it in <head>
.
I tried variations of append, appendTo and document.ready and document.load functions. None of those worked so far.
I went through cpuple of similar threads before I posted. I didn't seem to fix my issue