Data-attributes in Js

Week2 little takeaways of jQuery and Html

Use a callback function on randomly select star node( $starNode = $(‘<span class=”stars”></span>’) ) one at a time

The logic behind the shooting star is fairly easy. When creating $starNode, try give them both a className as stars, and also a self defined data-attribute: nodeIndex.

Code for the shooting stars


The custom data attributes is super easy to store extra “properties” that we wish to hide within the Html tag. It provides cleaner access selectors.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.