Skip to content

Instantly share code, notes, and snippets.

@codenamejason
Last active August 29, 2015 14:16
Show Gist options
  • Save codenamejason/b8d8ac999513e380c46b to your computer and use it in GitHub Desktop.
Save codenamejason/b8d8ac999513e380c46b to your computer and use it in GitHub Desktop.
Modify specified document types in links with a new class
$('a[href]').each(function() {
if((C = $(this).attr('href').match(/[.](pdf|doc|docx|xls)$/))) {
$(this).addClass(C[1]);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment