How to get the the <head> element content of the current document in JavaScript

1 Answer

0 votes
document.write(document.head + "<br />");

var dhead = document.head;

document.write(dhead.id + "<br />"); 
console.log(dhead.innerHTML); 


/*
run:

[object HTMLHeadElement]

<title>page title</title>

*/

 



answered Jun 10, 2016 by avibootz
...