button onclick inside whole clickable div

Solutions on MaxInterview for button onclick inside whole clickable div by the best coders in the world

showing results for - "button onclick inside whole clickable div"
Thibault
16 Apr 2018
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};
similar questions
queries leading to this page
button onclick inside whole clickable div