data- attributes html code example
Example 1: get data attribute javascript
// <div id="element" data-name="john"></div>
const el = document.querySelector('#element')
el.dataset.name // 'john'
Example 2: data attribute html
<!-- data-* attritubes can be used on any html element -->
<div data-my-custom-data="true"></div>