What are Data-Attributes in HTML5

Data Attributes

Data attributes allow us to store information on HTML elements. There are many ways to use these attributes. Before this, we have to depend on class attributes to store some information. In this article, will look into some examples and usage of data attributes.
 
 Suppose, if we are creating an application and we might want to store some information. we could do so by assigning custom data attributes. This data can be used for searching, filtering or grouping. These data is ignored by the browsers. You may provide as many data attributes in the element.
 
 The data attribute is always prefixed with data-.

In this way we can use lot’s of data in one single image. Further, you can use these attributes to display them with Javascript. The custom data attributes are valid HTML5.

See more on Data Attributes


Originally published at www.voltspecter.com.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.