← CodePrimer
HTML
Beginner
Basics
Custom data-* attributes
How do I store extra data on an element?
HTML5 data attributes.
<div id="product" data-price="25.99" data-category="electronics">Headset</div>
Notes
Read in JS via element.dataset.price / dataset.category.
Keywords: data · dataset · attribute · html5
Related
HTML
HTML headings h1–h6
How do I create page headings?
CSS
Three ways to apply CSS
What are inline, internal, and external CSS?
JavaScript
document.getElementById
How do I select one element by id?
PHP
Embed PHP inside HTML
How do I mix PHP and HTML?
HTML
Paragraphs and line breaks
How do I break text into paragraphs?
JavaScript
document.querySelector
How do I select with a CSS selector?