Return to Snippet

Revision: 35346
at November 5, 2010 21:39 by beso


Initial Code
$(document).ready(function(){
    $("a[href$='.pdf']").addClass("pdf");
	$("a[href$='.doc']").addClass("doc");
	//Add external link icon to external links - 
	$('a').filter(function() {
		//Compare the anchor tag's host name with location's host name
	    return this.hostname && this.hostname !== location.hostname;
	  }).addClass("external").attr("target","_blank");
});

Initial URL


Initial Description


Initial Title
Auto add a class to link files (pdf,doc,external)

Initial Tags
css, class, link

Initial Language
jQuery