8 November 2016

Add a document icon to document links

Here’s a simple cross-browser compatible way to prepend an icon to any document links using jQuery.:

The regex expression \. looks for anything after a ., and the i flag makes it case insensitive.

Works fine in earlier version of IE.

Working example.