Created
February 11, 2010 23:22
-
-
Save eyeseast/302107 to your computer and use it in GitHub Desktop.
Add paragraph-level permalinks in JQuery
This file contains hidden or 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() { | |
| $('#entry-text > p').each(function(i) { | |
| var p = $(this); | |
| p.attr('id', 'p' + i); | |
| var a = $('<a/>').attr('href', '#p' + i) | |
| a.attr('title', 'Link to this paragraph'); | |
| a.text(' #'); | |
| p.append(a); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment