jQuery: creating Wikipedia links from acronyms

Writing about web standards, I usually got a bunch of acronyms that could be better used. How? By wrapping and turning them into Wikipedia links. Here's the jQuery code:

function wrapAcronymsWithLinks() {

    $('acronym').each(function() {

        var $acronym = $(this);
        var text = $acronym.text().toUpperCase();

        $acronym.wrap('<a href="http://en.wikipedia.org/wiki/' + text + '"></a>');



Really simple.

This entry was posted in by Gabriele Romanato. Bookmark the permalink.

Leave a Reply

Note: Only a member of this blog may post a comment.