Skip to content

Instantly share code, notes, and snippets.

@aroc
Last active November 10, 2017 02:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aroc/ae4eeb1023d435b6e45b to your computer and use it in GitHub Desktop.
Save aroc/ae4eeb1023d435b6e45b to your computer and use it in GitHub Desktop.
SideComments markup example
<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>
@Minhyuk-Ji
Copy link

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++;
}
});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment