Is it possible to have multiple data-{name} atributes in HTML5?

html, javascript

Solution

You could put them all in one if you separated them by something then split them up and put them in an Array.

var arrayData = document.getElementById('viewport').getAttribute('data-requries');
var arr = arrayData.split(',');

for (i = 0; i < arr.length; i++) {
    console.log(arr[i]);
}

​ http://jsfiddle.net/S7D2D/1/

Problem

Is there a way to get all 3 data values from this element? ``` <div id="viewport" data-requires='js/base/paths' data-requires='js/base/dialog' data-requires='js/base/notifier'> ``` This would be really useful for a project that I am starting. With this I could load required js modules and link them to the dom. I know it might sound strange, but I'm trying something new here.

Original source