Automatically Discover Document Links And Apply Class

Submitted by:Jhon Smith

Date added:30 January, 2011

Category:jQuery

Automatically Discover Document Links And Apply Class

Tags: jquery snippet , apply class , discover document links

Code Snippet:

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

Comments