data-item html code example
Example 1: how to can i get custom data attribute value in javascript
example <button data-keyname = "a'></button>
let variable = element.dataset.keyname;
or
let varibale = element.['keyname'];
or
let variable = element.getAttribute('data-keyname');
Example 2: data attribute html
<!-- data-* attritubes can be used on any html element -->
<div data-my-custom-data="true"></div>