jQuery Sweet-Links Plugin Demo

A little jQuery plugin that can add some cool features to anchor tags on your website.

What does Sweet Links do?

A few things! Sweet Links can be applied to any or all anchor tags in your website. It will check the properties of the tag, and then execute the following functions:

  • The script will check if the href points to a document, and if so, it will add a class that can be used for styling as well as the download attribute.
  • The script will check if the href points to an anchor on the same page, and if so, smooth scroll to that anchor.
  • The script will check if there is a title attribute, and if not it will add one using the text content of the link.
  • The script will check if the href points to an external destination. If so, it will add a class that can be used for styling, the rel="external" attribute will be added, and if desired - an optional target="_blank" (disabled by default) will be added.


Sweet Links requires jQuery, so make sure this is referenced before Sweet Links. A version that does not require jQuery is in the works.

To add Sweet Links to your site, simply reference it after jQuery and then initialize it after document ready, as below:

<script type="text/javascript" src="~path~/jquery.js"></script>
<script type="text/javascript" src="~path~/sweet-links.js"></script>
<script type="text/javascript">
	jQuery(document).ready(function($) {

Options & Classes





Browser Support

Should work on everything, as long as Javascript is enabled.


Please report any bugs or possible improvements via GitHub.


If you would like to get notified about important plugin updates, you can star and/or watch the repository on GitHub, and follow me on Twitter


Sweet Links is available under MIT license and will always be kept this way. I will eventually build a WordPress Plugin based on this functionality so please be really cool and don't use my code to build your own. The WordPress plugin I plan to build will be have the same license.