I have a button appended to a parent button:
var parent_button = document.createElement("button");
var child_button = document.createElement("button");
parent_button.appendChild(child_button);
I want to create functionality for the child_button that's independent from that of the parent_button:
parent_button.onclick = function () {
//do stuff
};
child_button.onclick = function () {
//do some other stuff
};
But given this code, whenever I click on child_button, I am necessarily triggering parent_button.onclick(). How do I separate the two?
The overlapping buttons look like this: