I am getting list of badCatsNames
from webservices, now I have two asp.net bulleted lists here,
- Bulleted List 1 - Available Cats
- Bulleted List 2 - Purchasing Cats
Now I need to check each bad cat name if bad cat is in available cats list, if bad cat name is then take her out of Available Cats and put in Purchasing Cats ;), but if Cat is already in purchasing Cats list then put them in Available Cats list.
If bad cat name is not in any list then ignore it.
if(badCatsNames.length > 0)
{
for (var i = 0; i < badCatsNames.length; i++) {
var badCatName = badCatsNames[i];
$("[id$=listAvailableCats] li").each(function (index) {
if ($(this).text() == badCatName) {
$(this).appendTo($("[id$=listPurchasingCats]"));
}
else {
$("[id$=listPurchasingCats] li").each(function (index) {
if ($(this).text() == badCatName) {
$(this).appendTo($("[id$=listAvailableCats]"));
}
});
}
});
}
}}