dimanche 30 septembre 2018

How to appendChild an UL to a SPAN?

So, if we're going to append a LI to UL we should do this:

var list = document.createElement('li');
var ulist = document.createElement('ul);
ulist.appendChild(list);

what if I create a span, should I do this?

var list = document.createElement('li');
var ulist = document.createElement('ul);
var span = document.createElement('span');
span.appendChild(ulist);
ulist.appendChild(list);




Aucun commentaire:

Enregistrer un commentaire