W3c Validation gives an error when using data attribute "Attribute data not allowed on element a at this point"

StackOverflow https://stackoverflow.com/questions/20391908

  •  29-08-2022
  •  | 
  •  

문제

I'm validating my site using W3C validation and the validation gives error like data attribute is not allowed on anchor tag. I've removed and added the same data attribute to the parent tag again I'm getting the same error for that parent element.

도움이 되었습니까?

해결책

Whenever you see a reference to a "data attribute", it does not literally mean an attribute called data.

A data attribute, more fully known as a custom data attribute, is an attribute, of any name and value you choose, whose name is prefixed with data-. For example, data-color or data-category. Sometimes they're written as "data-* attributes" to make it clearer that the data- portion is a prefix and not the entire attribute name.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top