The dataset attributes can be
selected using JavaScript.
To do this, we have to convert
their values into camel case.
Let us have a look at an example:
As we can see, data attributes
can be accessed in JavaScript
with this syntax:
element.dataset.keyName
.
We can also use the bracket syntax
element.dataset[keyName]
.
Let us have a look at another example: