I have few spans:
<span name="5">a</span>
<span name="5">b</span>
<span name="5">c</span>
<span name="5">d</span>
I use getElementsByName
to get the span collection:
var spans = document.getElementsByName("5");
What I did next is clone the spans and put it into another span container:
var clonedSpan = spans.cloneNode(true);
var container = document.createElement("span");
container.appendChild(clonedSpan);
But the exception happens saying spans.cloneNode is not a function.
Any idea why?