Add item to jquery object

I have a cached jquery object setup like this

var comments = $('li.comment');

When creating new elements, is there an easy way to update comment objects rather than refinancing them? I'm looking for something like

comments += $('li.newcomment');

Is it possible?

+3
source share
1 answer
$("li.comment").add("li.newcomment");
+6
source

Source: https://habr.com/ru/post/1703284/


All Articles