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

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -