javascript - div not contains any string from an Array - Jquery -
I have to check that there is no string in any div from an array or not. We say that the array is:
var vals = ["a", "b", "c"]
I want to hide all the divs in which there is none These strings
demo Explanation: From the collection of divs, loop through each div; Inside the loop there is another loop which gives the edge through each value in the array. Check now if the value in the div is & amp; Then hide it
var vals = ["a", "b", "c"]; Var $ divs = $ ('. Container div'); $ Divs.each (function () {var $ currDiv = $ (this); $ .ec (wal, function (index, value) {if ($ currDiv.is (': (' + value + ') is included) & Amp; amp; $ currDiv.is (": appears")) {$ currDiv.hide ();}})}};
Comments
Post a Comment