Skip to content

Tag: dom

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&#8…

Detect click outside React component

I’m looking for a way to detect if a click event happened outside of a component, as described in this article. jQuery closest() is used to see if the target from a click event has the dom element as one of its parents. If there is a match the click event belongs to one of the children and is thus

TextNode or textContent?

What’s the advantage of creating a TextNode and appending it to an HTML element over setting directly its textContent? Let’s say I have a span. And I want to change its text. What’s the advantage of using : over span.textContent = ‘hello’; Answer It ‘s not really matter of …