Dynamically add an icon for external links


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #
  2. $(document).ready(function() {
  3. #
  4. $('#extlinks a').filter(function() {
  5. #
  6. return this.hostname && this.hostname !== location.hostname;
  7. #
  8. }).after(' <img src="/images/external.png" alt="external link"/>');
  9. #
  10. });

URL: http://www.learningjquery.com/2008/08/quick-tip-dynamically-add-an-icon-for-external-links

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.