Whether you have a web design project in mind or you just want to say hi, I'd love to hear from you.

t: @fanboyryan
e: talk@fanboycreative.co.uk

Close this

Fanboy - The Finest Web Design in Blackpool

  • Work
  • About
  • Blog
  • Contact
  • all
  • Articles
  • Code
  • Links
  • Photos
  • Quotes

Subscribe with RSS

Code

Use jQuery to target _blank

If you want to write strict XHTML and you’re having problems using

target="_blank"

on your links, there is a simple jQuery fix. Add this script to your page:

$(function() {
    $(".external").attr("target","_blank");
});

And give any links you want to open in a new window

class="external"

0

2

Posted July 25, 2009

Fanboy web design Blackpool. I like getting emails. Get in touch