1//event.target would help you in this
2 if (event.target.className === "delete") {
3 console.log("HELLO")
4 this.shortcutArray.splice(index, 1);
5 }
6
7form.onclick = function(event) {
8 event.target.style.backgroundColor = 'yellow';
9
10 // chrome needs some time to paint yellow
11 setTimeout(() => {
12 alert("target = " + event.target.tagName + ", this=" + this.tagName);
13 event.target.style.backgroundColor = ''
14 }, 0);
15};