<div id="button-container">
<button>Button 1</button>
<button>Button 2</button>
<button>Button 3</button>
</div>
xxxxxxxxxx
button {
background: cornflowerblue;
padding: 7px;
color: white;
border-radius: 5px;
margin: 5px;
border: none;
}
const container = document.getElementById('button-container');
container.addEventListener("click", (event) =>
alert(event.target.innerText)
)
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.