how to remove div onclick in javascript code example
Example 1: javascript remove item onclick
function remove(elem){
elem.parentNode.removeChild(elem);
}
<div id="i", onclick="remove(this)">click</div>
Example 2: remove element onclick javascript
function remove(el) {
var element = el;
element.remove();
}