Posted By

stephcode on 08/30/11


html strict jquery blank links all target

Versions (?)

jQuery compliant target="blank" effect for all links

 / Published in: jQuery


  1. //Open External Links in New Window
  2. $('a[href^="http://"]') .attr({ target: "_blank" }); //Makes all links open in a new window
  3. $('a[href^="http://"].target') .attr({ target: "_blank" }); //a link with the class of "target" opens in a new window

Report this snippet  

You need to login to post a comment.