How to store arbitrary data for some HTML tags?

Spread the love

Sometimes, we want to store arbitrary data for some HTML tags.

In this article, we’ll look at how to store arbitrary data for some HTML tags.

How to store arbitrary data for some HTML tags?

To store arbitrary data for some HTML tags, we use data- attributes.

For instance, we write

<div data-internalid="1337"></div>

to add the data-internalid attribute to the div and set its value to 1337.

Conclusion

To store arbitrary data for some HTML tags, we use data- attributes.

Leave a Reply

Your email address will not be published. Required fields are marked *