cem-u
10/1/2017 - 7:19 AM

array from nodelist.js


// get nodes that have data-time attribute like: <li data-time="2:30"></li>
var timeNodes = Array.from(document.querySelectorAll('[data-time]'));
var seconds = timeNodes.map(function(node){
  return node.dataset.time;  // returns [data-time] values of the elements into array
})

// get nodes that have data-time attribute like: <li data-time="2:30"></li>
var timeNodes = Array.from(document.querySelectorAll('[data-time]'));
var seconds = timeNodes.map(function(node){
  return node.dataset.time;  // returns [data-time] values of the elements into array
})