Reputation: 2361
I am a beginner in javascript. As mentioned in stack overflow query, I can remove or create elements within the DOM. However, can I replace the root element through javascript e.g. if I want to change an attribute of the HTML element through javascript?
Upvotes: 4
Views: 2499
Reputation: 1981
I think you're asking if you can modify the element, and the answer is yes.
var html = document.getElementsByTagName('html')[0];
html.title = "Foo"; // Set an attr on the element
Upvotes: 4