I have a task that is to create links on navigation list's "li" elements and its text. So I have to add a anchor element with a href attribut to three li elements with class="navigation". I tried to do a code to this, but it's not correct can anyone help me to make it work.
var a = document.createElement("a");
var li = document.getElementsByClassName("navigation");
for (i = 0; i < a.length; i++) {
a.setAttribute("href", "#html");
li.appendChild(a);
}
li class = "navigation" - should be changed to be - li class = "navigation" a href="#HTML" and so on for the three "li" elements.