jquery - Remove child elements with certain attribute value -
i'm trying filter out children elements, i'm not managing iterate throught children properly. whats wrong in code:
$("#filter").on("click", function() { $("div#results > div").each(function () { if(!$(this).attr('subcategory', 0)){ $(this).remove(); } }); });
$(this).attr('subcategory', 0)
set value attribute. try this:
$("#filter").on("click", function() { $("div#results > div").each(function () { if($(this).attr('subcategory')==="0")){ $(this).remove(); } });});
Comments
Post a Comment