Traversing the DOM
One of my favorite things about this was instead of having to use the
event handler to traverse a certain part of the DOM (when something is clicked) you could listen for any type of click events with
to listen for a click on an element specified as the argument to the method. For instance here:
addButton.onclick = addTask; //Set the click handler to the addTask function addButton.addEventListener("click", addTask); addButton.addEventListener("click", ajaxRequest);addButton.onclick = addTask; //Set the click handler to the addTask function addButton.addEventListener("click", addTask); addButton.addEventListener("click", ajaxRequest);This is much faster and easier than traversiing each element with theonclick();method.
Welcome Aboard Nick Lash as a New Contributor to the BlogNick and I connected on LinkedIn and, impressed with my social media and blogging output, reached out to me to collaborate on the blog and my podcast which you can find here. I found a place for him to write here and he will be a co-host on my weekly show which hasn’t been weekly in a minute. My fault totally. But that changes with Nick on board. Thanks Nick and I hope you get something out of it. I hope my readers enjoy his posts as well. You can find Nick on Twitter.