add class and target _blank to all external links


/ Published in: jQuery



Copy this code and paste it in your HTML
  1. $('a[href^="http://"]').attr({ target: "_blank" }).addClass("external-link");

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.