Cómo obtener los datos adjuntos con un elemento en JavaScript
HTML>
<article
id="electric-cars"
data-columns="3"
data-index-number="12314"
data-parent="cars">
...
</article>
JS>
const article = document.querySelector('#electric-cars');
// The following would also work:
// const article = document.getElementById("electric-cars")
article.dataset.columns // "3"
article.dataset.indexNumber // "12314"
article.dataset.parent // "cars"
Breakable Baboon