Home  >  Article  >  Web Front-end  >  html5 custom attributes: how to get custom attribute values ​​(with code)

html5 custom attributes: how to get custom attribute values ​​(with code)

不言
不言Original
2018-08-09 14:15:365621browse

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']




    
    Title

传智播客

传智播客

Related articles Recommended:

Detailed analysis of the for attribute of the 2e1cf0710519d5598b1f0f14c36ba674 tag in html

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn