Is it possible to get only one DOM contains by tag name without ID and class?
As you know, in HTML5 <main>
, <header>
and other new tags has been added, and thanks to it, to define the style of header or footer, assigning the class or id line <div class="header">
becomes unnecessary.
E. g. I need to get the <header>
contains, like
var test = document.getElementById("test");
by don't want to assign ID or class to header (nothing difference between <div id="header">
and <header id="header">
. However
var test = document.getElementsByTagName("header") ;
will not work (I mean will not save the <header>
contains in variable value) even if there is only one header in the page.
Anything that I can to do?
test
test
. Sorry that I didn't use the professional language. – Takeshi Tokugawa YD Jul 08 '16 at 03:50