How do I assign the HTML of each child to a variable in jQuery?
For example, I have
<li>
<div class="hide video_id keep">50</div>
<div class="hide video_id keep">49</div>
</li>
And I want 50 and 49 each stored in a variable. I'm not sure how many of those divs there are, but I will need it to work for each one. Is there any easier way to accomplish this besides using a for loop?
Just for context, I am using these values to remove video thumbnails from the DOM (which is why I added the "keep" class for thumbnails I will not remove).
Update: Here is the code I am using for filtering the videos when a category is clicked.
$('.category').click(function() {
$(this).children().addClass('keep');
var numbers = [];
$(".video_id:not(.keep)").each(function () {
numbers.push($(this).text());
});
console.log(numbers);
$('.thumbnails:gt(8)').remove();
updatePaginate();
});