Question about custom attributes of html tags _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
HTMLJS is not affected. You can write n attributes. As long as the defined attribute name is different from the original default attribute name. The browser does not parse this custom attribute. Previously, the developer honestly uses the default html attributes, such as class and name. I switched to Huawei's outsourcing service to build a mall system using an open-source framework. During encoding, you may encounter the following situations: There are many custom tags in the tag.

The Code is as follows:


_ M"
Src =" _ S "style ="-ms-interpolation-mode: bicubic; cursor: pointer ;"
Onclick = "queryProductDetail (this );"
InfoType =" "
Id =" "
ModuleId =" "
ChsDesc =" "
EngDesc =" "
ChsName =" "
EngName =" "
Onerror = 'checkimagefile (this );'
Onload = "DrawImage (this, 174,116)"/>


Summarized several points:

1. It has no effect on html js. You can write n attributes.

2. As long as the defined property name is not the same as the original default property name.

3. the browser will not parse this custom property

4. JS can get its value through xxx. getAttribute ("your written attribute ").

This benefit should be obvious. This should be applied more in the future.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.