Question about custom attributes of html tags

Question about custom attributes of html tags

In previous development, we used the default attributes of HTML, such as class, name, etc. I switched to Huawei's outsourcing company and developed a shopping mall system using an open source framework. When coding, I encountered the following situation. There are many custom tags in the tag.

Copy code
The code is as follows:

<img msrc="<s:property value='#product.images'/>_m"
src="<s:property value='#product.images'/>_s" style="-ms-interpolation-mode:bicubic; cursor:pointer;"
onclick="queryProductDetail(this);"
infoType="<s:property value='#product.unitType'/>"
id="<s:property value='#product.unitID'/>"
moduleId="<s:property value='#product.unitID'/>"
chsDesc="<s:property value="#product.chsSimpleDesc"/>"
engDesc="<s:property value="#product.engSimpleDesc"/>"
chsName="<s:property value="#product.chsName"/>"
engName="<s:property value="#product.engName"/>"
onerror='checkImageFile(this);'
onload="DrawImage(this,174,116)"/>

Summarize a few points:

1. No impact on HTML JS. You can write multiple attributes.

2. Just make sure the name of the defined attribute is not the same as the original default attribute.

3. The browser will not parse this custom attribute

4. JS can get its value through xxx.getAttribute("the attribute you wrote")

The benefits of this should be obvious. This should be used more often in the future.

<<:  How to avoid duplication of data when inserting in MySql batch

>>:  CSS3 property line-clamp controls the use of text lines

Recommend

Implementation of the login page of Vue actual combat record

Table of contents 1. Preliminary preparation 1.1 ...

Example usage of JavaScript tamper-proof object

Table of contents javascript tamper-proof object ...

Notes on matching MySql 8.0 and corresponding driver packages

MySql 8.0 corresponding driver package matching A...

A brief discussion on the efficiency of MySQL subquery union and in

Recent product testing found a problem that when ...

React Hooks Common Use Scenarios (Summary)

Table of contents 1. State Hook 1. Basic usage 2....

Detailed explanation of the binlog log analysis tool for monitoring MySQL: Canal

Canal is an open source project under Alibaba, de...

How to fix the footer at the bottom of the page (multiple methods)

As a front-end Web engineer, you must have encoun...

Implementation of iview permission management

Table of contents iview-admin2.0 built-in permiss...

Vue implements graphic verification code

This article example shares the specific code of ...

How to add configuration options to Discuz! Forum

Discuz! Forum has many configuration options in th...

How to use CSS style to vertically center the font in the table

The method of using CSS style to vertically cente...

About the overlap of margin value and vertical margin in CSS

Margin of parallel boxes (overlap of double margi...

Implementing license plate input function in WeChat applet

Table of contents Preface background Big guess Fi...

Native js canvas to achieve a simple snake

This article shares the specific code of js canva...