0

http://jsfiddle.net/1wqdmo4o/

var whichSelected = document.querySelectorAll(".selected");

for(var i = 0; i < whichSelected.length; i++) {

    var clone = whichSelected[i].cloneNode(false);
    clone.addEventListener("click", function() {createOutline(clone)});
    document.body.appendChild(clone);

}

I have no idea why the event listener will not work on the clones. Any ideas is appreciated!

1 Answers1

2

You are setting the z-index of the copied node to -1, so when clicking, you click on body.

Also, the id is the same as the copied node, you might want to change this.

Arg0n
  • 8,283
  • 2
  • 21
  • 38