Home » Tag Archives: CSS (page 2)

Tag Archives: CSS

Be Slightly Careful with Sub Elements of Clickable Things

Say you want to attach a click handler to a <button>. You almost surely are, as outside of a <form>, buttons don’t do anything without JavaScript. So you do that with something like this: var button = document.querySelector("button"); button.addEventListener("click", function(e) { // button was clicked }); But that doesn’t use event delegation at all. Event delegation is where you bind ...

Read More »

Powered by WP Robot