Answers for "javascript set data attribute"

0

javascript change data attribute value

element.dataset.keyName = 'newValue';
Posted by: Guest on April-10-2021
0

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 // "3"
article.dataset.indexNumber // "12314"
article.dataset.parent // "voitures"
Posted by: Guest on May-25-2020

Code answers related to "javascript set data attribute"

Code answers related to "Javascript"

Browse Popular Code Answers by Language