JSFiddle - React, Tailwind, and code Playground
by Luke Arrington
HTML
<!-- top -->
<div>top stuff</div>
<!-- Content -->
<div>content stuff</div>
JavaScript
$.fn.getComments = function () {
return this.contents().map(function () {
if (this.nodeType === 8) return this.nodeValue;
}).get();
}
var comments = $('body').getComments();
console.log = (comments[0]);
alert(comments[1]);
alert(comments[2]);
alert(comments[3]);
alert(comments[4]);
alert(comments[5]);
alert(comments[6]);
alert(comments[7]);
alert(comments[8]);
alert(comments[9]);
alert(comments[10]);