Array 'myPicks' has a unique list of classes (.scifi, .adventure, etc.) , which will be used for sorting.
There is also an unordered list with li items, all with the class '.possibleMatch'
I am using variable 'camel' to filter through all of these '.possibleMatch' li's using the following:
var camel = $('.possibleMatch').not(myPicks.join(','));
Now, once I call camel,
camel.html(camel).html();
the HTML updates with an unordered list with only li items with the classes specified in 'myPicks'.
This is working as I had hoped, but now I am stuck on how to move all the removed li items into another unordered list, that goes under the original unordered list.
I've tried
var noLonger = $('.possibleGames').filter(myPicks.join(','));
$('#somewhatMatch').html(noLonger.html(noLonger).html());
to try to move the removed items to a new unordered list, #somewhatMatch, but to no avail, now the original list will only show li items without the classes specified in 'myPicks'.
Please help!
--
Code that worked, if anyone uses this obscure question in the future:
//not sure why, but must clone beforehand
var llama = camel.clone();
//the following updates the original ul with items that match criteria
camel.html(camel).html();
//the following moves unmatched items into a new ul
$('#somewhatMatch').append(llama);
I think what you need is
var noLonger = $('.possibleGames').filter(myPicks.join(','));
$('#somewhatMatch').empty().append(noLonger.clone());
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.