Reputation: 11404
So the code below will get the ID of the BODY elementL
var bodyId = document.body.id;
How can I get the ID of the HTML element using plain ole' JavaScript?
Upvotes: 2
Views: 35737
Reputation: 50497
document.getElementsByTagName('HTML')[0].id
Upvotes: 4
Reputation: 129011
document.documentElement.id
Upvotes: 12