---
title: "Comment by M Rawash on \"10 useful HTML5 features, you may not be using\" | Hashnode"
description: "That&#39;s not how you access data-* attributes from Javascript. Use elm.dataset.foo"
url: "https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942/comment/5f389e66c4d5973f55c90c47"
---

[Discussion](https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942)

Comment [10 useful HTML5 features, you may not be using](https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942)

[M Rawash](https://hashnode.com/@gwash)

[Aug 16, 2020](https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942/comment/5f389e66c4d5973f55c90c47)

That's not how you access data-\* attributes from Javascript. Use elm.dataset.foo

[Tapas Adhikary](https://hashnode.com/@atapas)

[Aug 16, 2020](https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942/comment/5f389e66c4d5973f55c90c47#reply-5f38a4fec4d5973f55c90c60)

Yeah, I missed to incorporate that. Updated now.

> Note: For reading the values of these attributes in JavaScript, you could use `getAttribute()` with their full HTML name(i.e, data-custom-attr) but, the standard defines a simpler way: using a `dataset` property.

Thanks for pointing out!

[M Rawash](https://hashnode.com/@gwash)

[Aug 16, 2020](https://hashnode.com/posts/10-useful-html5-features-you-may-not-be-using/5f3694f2877a013acb03c942/comment/5f389e66c4d5973f55c90c47#reply-5f38a791c4d5973f55c90c71)

[Tapas Adhikary](https://hashnode.com/@atapas) You can, of course, access any HTML attribute with getAttribute(), however the 'dataset' property is what makes 'data-\*' attributes special and much more convenient to use. Thanks for updating the article.
