javascript - Jquery loop through each li for each ul -


There is currently a loop that goes through every Lee, and searches for some content in Lee and Adds a class. The problem is that there are many ULs in the layout, so I want to find it within each of UL. Okay, now it prevents me from the first moment of any Li that matches the criteria.

  var list = $ ('sampleAddress li span'); $ (List.get). Reverse ()). Each (function () {var currentLine = $ (this) .html (); var mismatch = unmatched line; if (currentLine.indexOf! == -1) {$ (This) .html ($ (this) Replace ("", "") .replace ("&", "and amp;"). Change (UnmatchedLine.toUpperCase), & lt; span class = "matchedclass" & gt; '+ Unchanged LAN.Uppercases () +' & lt; / span & gt; ')); Returned;}});   

The layout of the HTML is as follows

  & lt; Ul class = "boxSlider" & gt; & Lt; Li & gt; & Lt; Ul class = "sampleAddress" & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Ul class = "sampleAddress" & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; Period & gt; Some other & lt; / Span & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Li & gt; & Lt; / Ul & gt; Using a different loop for    

ul

  $ ('SampleAddress'). Each (function () {var list = $ (this) .find ('li span'); $ (list.get () .reverse ()). (Function () {var currentLine = $ (this) .html (); Var mismatch = unmatched; if (current LAN.indexoff!) == -1) Change {$ (this) .html ($ (this) ("", ""). Replace ("& amp; "," And amp; AMP; ") (UnmatchedLine.toUpperCase), '& lt; span class =" matchedClass "& gt;' unmatched line .toUpperCase () + '& lt; / span & gt;') ); Return return;}})}}    

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -