Last active
November 10, 2017 02:58
-
-
Save aroc/ae4eeb1023d435b6e45b to your computer and use it in GitHub Desktop.
SideComments markup example
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
<div id="commentable-area"> | |
<p data-section-id="1" class="commentable-section"> | |
This is a section that can be commented on. | |
</p> | |
<p data-section-id="2" class="commentable-section"> | |
This is a another section that can be commented on. | |
</p> | |
<p data-section-id="3" class="commentable-section"> | |
This is yet another section that can be commented on. | |
</p> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
adding class and section-id In my case.
MUST attr. NOT data.
my code ::
$(window).on('load', function() {
var idNum = 1;
$(".content").attr("id", "commentable-area").find("p").each(function () {
if ($(this).text == "") {
} else {
$(this).removeClass("commentable-section").addClass("commentable-section").attr("data-section-id", idNum);
idNum++;
}
});
});