Answer the question
In order to leave comments, you need to log in
How to remove the created DIV in JS?
I create a div by copying it:
var value = this.innerHTML,
div = this.cloneNode(true);
document.querySelector('.my .interests').appendChild(div);
function delEl(selector, event, callback) {
var items = document.querySelectorAll(selector);
for(var i=0; i<items.length; ++i)
items[i][event] = callback;
};
delEl('.my .interests .el', 'onclick', function(){
this.remove();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question