Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue - Q. How to use data- attribute in html5? #1

Closed
RockL30 opened this issue Oct 31, 2022 · 1 comment
Closed

Issue - Q. How to use data- attribute in html5? #1

RockL30 opened this issue Oct 31, 2022 · 1 comment

Comments

@RockL30
Copy link

RockL30 commented Oct 31, 2022

Fixed code since getElementById is not working

According to mdn we can use querySelector -
-> https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes

const article = document.querySelector("#electric-cars");

article.dataset.columns; // "10"
article.dataset.indexNumber; // "100"
article.dataset.parent; // "cars"
@learning-zone
Copy link
Owner

Thanks for creating issue, Code has been updated now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants