Hi! I started a course for HTML5 basics.
I know a little about DOM an know that you can use Javascript to access and change elements.
In the HTML5-course they use this code (can’t see all because I use the trial-account at PluralSight)
[CODE]var items = document.getElementsByClassName(“example”), log = document.getElementsById(‘log’);
log.innerText = items.length + ‘ “Item” + elements’;
The teacher says that this is pure HTML5.
So my questions:
If it is pure HTML5, when should I use this and when should I use Javascript or other?
I guess that items are an array? Could someone explain the code in detail?
You cant use variables in HTML5, or can you?