Sometimes I need just to update a site and the document type is in Strict mode, for me in the beggining I used to use target=blank on links, but the XHTML 1.0 in Strit mode don´t allow us to use this attribute.
So how to do a site with no warning and errors in the html without tagert=blank? Simple let´s take Jquery do it for us.
The example above I use the rel element, but you can use a class or a id if you want, rel element is more semantic.
Javascript
$('a[@rel$='external']').click(function(){
this.target = "_blank";
});
Html
<a href="http://www.webmista.com" rel="external">webmista</a>
Subscribe to comments
Responses closed, but you can trackback. |
Post Tags: