I would like to add more li elements, like the first one, dynamically, i.e. by pressing a button. Here is a not working example on jsfiddle
document.onload = init;
function init(){
document.getElementById('add').onclick = add;
}
function add(){
var el = document.getElementById('list');
var node = document.createElement("li");
var link = document.createElement("link");
link.setAttribute('href', 'www.google.it');
link.setAttribute('name', 'link');
node.appendChild(link);
el.appendChild(node);
}
<ul id="list">
<li>
<a href="www.google.it">link</a>
</li>
</ul>
<button id="add">Add link</button>