Question

I am checking code on w3c validator and I keep getting these errors for each individual blog and portfolio post that has the "Like" button attached to it. Is there something I can do to correct these errors so they validate properly?

Here is a sample of the code:

<a href="#" class="like " title="Like this" data_action="likepost" data_postid="74" data_nonce="13e20f93ee">
    <span class="glyphicon glyphicon-heart"></span>
    <span class="likecount">2</span>
</a>
Était-ce utile?

La solution

Make sure you have doctype declaration like:

<!DOCTYPE html>

and replace the custom attributes as :

data-action data-postid and so on.

Note the hyphen instead of underscore. HTML5 allows custom attributes and suggests to use those which starts with data- .

A custom data attribute is an attribute in no namespace whose name starts with the string data-, has at least one character after the hyphen, is XML-compatible, and contains no uppercase ASCII letters

Reference

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top