This article introduces you to html5 custom attributes: how to obtain custom attribute values (with code). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.
Custom attributes:
In HTML5 we can customize attributes, the format is as follows data-*="", for example: data-info="I am a custom attribute", through Node.dataset['info'] We can get the custom attribute value.
When we set the format as follows, we need to use camel case format to get it correctly: data-my-name="itcast", get Node.dataset['myName']
Related articles Recommended:
Detailed analysis of the for attribute of the
How to solve the problem of label nesting in html
The above is the detailed content of html5 custom attributes: how to get custom attribute values (with code). For more information, please follow other related articles on the PHP Chinese website!