Code Snippet
Automatically Discover Document Links And Apply Class
$('a[href]').each(function() {
if((C = $(this).attr('href').match(/[.](doc|xls|pdf)$/))) {
$(this).addClass(C[1]);
}
});This will look through every a element on the page. If the href attribute of it has a .doc, .xls, or .pdf in it, it will apply the appropriate class name to it (e.g. class="doc")
Works like a champ!
$(“a[href$='.doc']“).addClass(‘doc’);
Although IE6 would degrade to a normal link, this can be done by CSS.
a[href$='.doc'] { padding-right:16px; background: transparent url(images/doc.png) no-repeat top right; }
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.