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

Improve the JavaScript section on the data attributes page #37715

Open
sdavids opened this issue Jan 19, 2025 · 0 comments
Open

Improve the JavaScript section on the data attributes page #37715

sdavids opened this issue Jan 19, 2025 · 0 comments
Labels
accepting PR Feel free to open a PR to resolve this issue Content:Learn Learning area docs

Comments

@sdavids
Copy link

sdavids commented Jan 19, 2025

MDN URL

https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Solve_HTML_problems/Use_data_attributes

What specific section or headline is this issue about?

JavaScript access

What information was incorrect, unhelpful, or incomplete?

Please improve the JavaScript example by showing querySelectorAll in combination with a data attribute selector.

It is implicitly shown via the CSS section and mentioned on querySelectorAll but having it explicitly in this section would be beneficial.

What did you expect to see?

document.querySelectorAll('article[data-indexnumber="12314"]')

Maybe also a link to querySelectorAll.

Do you have anything more you want to share?

<ul id="something">
  <li data-id="1">A
  <li data-id="2">B
  <li data-id="3">C
</ul>
document.querySelector('#something [data-id="2"]')

Is a very common pattern so having the selector shown will be beneficial.

@sdavids sdavids added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jan 19, 2025
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jan 19, 2025
@sdavids sdavids changed the title https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Solve_HTML_problems/Use_data_attributes#javascript_access Improve the JavaScript section on the data attributes page Jan 19, 2025
@Josh-Cena Josh-Cena added Content:Learn Learning area docs accepting PR Feel free to open a PR to resolve this issue and removed Content:WebAPI Web API docs needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PR Feel free to open a PR to resolve this issue Content:Learn Learning area docs
Projects
None yet
Development

No branches or pull requests

2 participants