Skip to content
Advertisement

appending to the DOM – vanilla javascript

I wanted to practice my vanilla javascript skills since I’ve been so library-heavy lately. My goal was to filter an array of JSON data (by events after 10/01/2015), and then append them as list items to the DOM, with the class being “events”, and give the ability to delete events. Why isn’t this working?

https://jsfiddle.net/youngfreezy/7jLswj9b/

JavaScript

Advertisement

Answer

when you do:

JavaScript

listItem is a string. You cannot append it as a child, you need to create a DOM element and append that:

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement