data id html code example
Example 1: accèder data-id javascript
<article
id="voitureelectrique"
data-columns="3"
data-index-number="12314"
data-parent="voitures">
...
</article>
var article = document.getElementById('voitureelectrique');
article.dataset.columns
article.dataset.indexNumber
article.dataset.parent
Example 2: data id tag
var dataId = $(this).attr("data-id");
Example 3: javascript dataset
<div id="user" data-user-id="2" data-user-date-of-birth="03/03/1993">
<p> Hello ! </p>
</div>
const user = document.getElementById('user')
console.log(user.dataset.userId)
console.log(user.dataset.userDateOfBirth)