The dataset is a read-only
property that allows us to set
and get custom data attributes,
data-*
, on our HTML elements.
All dataset attribute names
should begin with data-
.
Let us have a look at an example
of adding custom data attribute
in HTML:
As we can see, in the above
code we are defining data
,
the data property is called
fruit-name
and its value
is orange
.
The usage of the same will be
discussed further in the
context of HTML DOM.