$(document).ready(function () { 'use strict'; // Use attr() to add an id, rel, and title. $('div.chapter a[href*="wikipedia"]').attr({ rel: 'external', title: function () { return 'Learn more about ' + $(this).text() + ' at Wikipedia.'; }, id: function (index, oldValue) { return 'wikilink-' + index; } }); // Add "back to top" links. $('back to top').insertAfter('div.chapter p'); $('').prependTo('body'); // insertBefore prependTo appendTo insertAfter // Create footnotes. // This works just as well, in spite of what the book says. // $('span.footnote').insertAfter('div.chapter'); $('span.footnote') .insertBefore('#footer') .wrapAll('
    ') .wrap('
  1. '); });