Created
November 5, 2016 23:37
-
-
Save aaronpk/8e6d92c455cd3bce896b32eaecb714ed to your computer and use it in GitHub Desktop.
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
function addParagraphIDs() { | |
$("section").each(function(){ | |
var section_id = $(this).attr("id"); | |
var counter = 1; | |
$(this).find("p").each(function(){ | |
var paragraph_id = section_id + "-p-" + counter; | |
counter++; | |
$(this).attr("id", paragraph_id); | |
}); | |
var counter = 1; | |
$(this).find("li").each(function(){ | |
var paragraph_id = section_id + "-li-" + counter; | |
counter++; | |
$(this).attr("id", paragraph_id); | |
}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment