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

  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 ();}})}};   

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

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -