Created
March 21, 2012 11:11
-
-
Save emayk/2146259 to your computer and use it in GitHub Desktop.
jquery : div replace link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function() { | |
$('div.chapter a[@href*=wikipedia]').each(function(index) { | |
var $thisLink = $(this); | |
$thisLink.attr({ | |
'rel': 'external', | |
'id': 'wikilink-' + index, | |
'title': 'learn more about ' + $thisLink.text() + ' at Wikipedia' | |
}); }); | |
}); | |
$('<a href="#top">back to top</a>').insertAfter('div.chapter p'); | |
$('div.chapter p').after('<a href="#top">back to top</a>'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment