I have a need to change something within a page depending on the body tag id.
My code doesn’t seem to work, can you help?
function changeHeaderTitle(){
var bodyId = document.getElementsByTagName("body").id;
alert(bodyId);
}
This just echoes “undefined”.
getElementsByTagNamereturns collection of nodes, even if the collection is bound to contain only one element. Tryor better yet