$('.target-blank').each(function() { $(this).attr('target', '_blank'); });

One line of jQuery, as shown above, allows you to omit your target attribute in favor of the XHTML Strict friendly class attribute. Drop a

class="target-blank"

on any anchor tag

<a class="target-blank" href="http://www.sitekickr.com">kick your website into gear</a>

and jQuery will adjust it's target attribute.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *