/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
$(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"); });