Design w/ Soul

Design comes to life when the soul is there

Michael Li's Design Blog


Welcome!

Create Event Listener for Dynamically Generated HTML Elements in Javascript

For generated dynamic HTML elements, if you try to create an event listener in HTML for them, it usually won’t work. The correct way is to create event listener in your Javascript file, like so:

yourElement.addEventListener("click", yourEventFunction, false);

This way, a click event listener is created in your Javascript file and the youEventFunction will be executed once the yourElement is clicked.

Next Post

Sometimes you clone your own repo from GitHub on another machine and try to do quick updates on it, then you want to push back the changes. But when you try to get a git push running, you get an 403 error. How come? Well it’s because when you clon...…

Read more
Last Post

How to use Google Fonts in Your Websites

Web fonts like Google Fonts are quite prevalent these days and used well can make your websites look way more professional and sophisticated. It is super easy to do actually. Here’s how: Go to Google Fonts website Search for typeface that you li...…

Read more