Posted By

jackkeller on 11/01/11


Tagged

jquery


Versions (?)

Automatically Discover Document Links And Apply Class


 / Published in: JavaScript
 

  1. $('a[href]').each(function() {
  2.    if((C = $(this).attr('href').match(/[.](doc|xls|pdf)$/))) {
  3.        $(this).addClass(C[1]);
  4.    }
  5. });

Report this snippet  

You need to login to post a comment.