JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<ul>
    <li>List item one</li>
    <li>List item two</li>
    <li>List item three</li>
    <li>List item four</li>
    <li>List item five</li>
    <li>List item six</li>
</ul>

JavaScript

Object.prototype.on = function (evt, fn) {
    var self = this.length ? this : [this];
    for (var i = 0, len = self.length; i < len; i++){
        self[i].addEventListener(evt, fn, false);
    }
};
Object.prototype.remove = function(){
    var self = this.length ? this : [this];
    for (var i = 0, len = self.length; i < len; i++){
        self[i].parentNode.removeChild(self[i]);
    }
};

document.querySelectorAll('li').on('click', remove);