I used this code to match list of elements:
var previewItems = preview.find(\'.items\').children().not(\'.heads\');
Everything works fine, but
Why the jQuery keeps the element in the group of the matched elements?
In case you want to do something with it after removing it. remove
removes the element from the DOM, but you may well want to do something further (like adding it elsewhere in the DOM or retrieving information from it).
You can remove it from the set using slice or not or filter (or more accurately: You can get a new object with all the same elements except the ones omitted by slice
/not
):
previewItems.eq(index).remove();
previewItems = previewItems.not(previewItems[index]);