Automatically Discover Document Links And Apply Class with jQuery

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

Leave a Reply