I have a list of objects
[Object, Object, Object]
Each objects has
Object {x: 1, y: 0, width: 4, height: 5, max_width: undefined…}
and some other parameters. Each object is a <div> element with data attributes <div id="panel" data-panel-id="2">. How can I get the value of data-panel-id?
I have tried
items.forEach(function (item) {
console.log(item);
console.log(item.el);
console.log(item.el.firstNode);
console.log(item.el.firstNode.dataset);
etc.
I think it would work if I used document.getElementById("panel").dataset.panelId but my list contains objects and not html elements, so I don't know how to do it.
My list of objects is created from gridstack.js library (https://github.com/troolee/gridstack.js) in an onChange listener.