There is no attribute “target” HTML strict Fix

There is no attribute “target” w3c error experience.

I have a habit with my blogs, about once or twice a month, i checked the validation in w3c. With this blog, i have checked almost once a week or sometimes more often, depends on how often i modify some stuff.

My another experience with validating wordpress code is with Thesis theme.

I choose Thesis is the best SEO theme for wordpress, one of the reason is it has clean code, therefore it is validated in W3C validator. (see more about how to validate wordpress in w3c post)

The great thing with Thesis is also it has XTML strict, which is good, but harder to learn.

Thing was i wanted to put “target:_blank” on my link, and i checked the validator, the result is there is no attribute “target” error message.

There is no attribute “target” XHTML Strict and Transitional.

This blog uses XHTML Transitional, therefore i can use the code: target=”_blank”. But Thesis theme is using XHTML strict, this is why we can’t use target=”_blank” otherwise it will end to there is no attribute “target” in w3c validator website.

I choose to learn XHTML transitional since it is not so difficult and has less rules than the strick ones. Transitional is easier to learn for beginners, like myself.

The benefit of having XHTML strick is it makes visitors browsers to renders our sites more strict, means it improves accessability of your site, by visitors, and search engines bots.

There is no attribute “target” w3c error fix.

If you use Thesis or other XHTML strict document, there are some attributes that you can’t use, but allowed in transitional.

For example, in my case, i wanted to validate the target=”_blank” but got there is no attribute “target” error notification.

The error screenshot:
there is no attribute target

How to fix? it is actually not complicated, after doing researches in some forums, i found this code is validated to replace:

onclick="target='_blank';"

So example: you want to type: <a href=”#” target=”_blank”> in XHTML strict, you will have to modify that code to:

<a href=”#” onclick=”target=’_blank’”>

It can be tricky sometimes, see more on one of my post validating javascript in wordpress.

That’s how i fix my there is no attribute “target” error notification invalid message in w3c.

Share the knowledge
Share on Google+0Tweet about this on TwitterShare on Facebook0Pin on Pinterest0Share on Reddit0Email this to someonePrint this page

Comments