I am using the Pinterest "Pin It" Button plugin so I can add to my posts/images. However, part of the Pin In button uses this code:

<img border="0" class="pib-count-img" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />

There is no ALT attribute for the image and my blog is failing HTML5 validation on http://validator.w3.org because of this. I keep getting the error: 'An img element must have an alt attribute, except under certain conditions. For details, consult guidance on providing text alternatives for images.'

How can I add the ALT attribute ( alt="Pin It" ) to the image used for the Pin It button so that my blog pages pass validation?

[ Note: I've tried jQuery $('.pib-count-img').attr('alt', 'Pin It'); but with no success. ]

  • Unless I'm seriously missing something, you should be able to go into your code and directly add the alt attribute...Is this button controlled by a plugin or something? – Thought Space Designs Sep 26 '13 at 4:48
  • @ThoughtSpaceDesigns yes the button is controlled by a plugin and it doesn't seem to have a setting in which I can add the ALT text for the button – user1794295 Sep 26 '13 at 8:30
  • Is there any possibility you could add this button on your own without the plugin? You can get code from here: business.pinterest.com/widget-builder/#do_pin_it_button and then just put your alt tag in and put it on your website. – Thought Space Designs Sep 26 '13 at 13:04
  • @ThoughtSpaceDesigns yes that's a good alternative I will consider, thanks! – user1794295 Feb 6 '14 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.