3 ms·
A simple helper function makes DOM manipulation non-painful as well. One example is https://gist.github.com/1532562 https://gist.github.com/1532562 or my fork h
by jacobr 14y ago
A simple helper function makes DOM manipulation non-painful as well. One example is https://gist.github.com/1532562 https://gist.github.com/1532562 or my fork https://gist.github.com/3524145 https://gist.github.com/3524145
It's used like this:
el ( tagName, properties, children )
Working with data structures is easy, children is just an array which can be the results of something like data.map() turning the data into elements.
- Too 14y agoThis is very effective. After a while this is basically as writing html. An added benefit is that it's very easy to attach events or other javascript properties to any object in the hierarchy.