1

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.

0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for the solution! I just noticed the code had "data" instead of "data-".
You're welcome, but I had to edit your comment - there is a reason I don't go by my real name on Stack Overflow even though I do elsewhere, so please don't. The way we say thanks on SO is to mark answers as accepted by clicking the checkmark underneath the number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.