I have following html list:
<ul>
<li class="list-group-item ReplyPill">This is my first value<span class="badge badge-pill"><div id="close">X</div></span></li>
<li class="list-group-item ReplyPill">This is my second value<span class="badge badge-pill"><div id="close">X</div></span></li>
(...)
</ul>
and I am using this jQuery to get all 'li' elements:
let replyOptions = [];
$('.ReplyPill').each(function () {
replyOptions.push($(this).text());
});
The problem is that the "X" from the 'div' is also read and my output looks like this: "This is my first valueX"
I already tried ".not('#close')" to exclude the div, but it did not change anything.
So is there a way to ignore the 'div' with the id "close" in the loop?