0

I'm trying to loop through all <li> tags that contain the class .fas using the jQuery contains() method and perform some stuff on each one.

$('li:contains(".fas")').each(function (index) {
    //stuff
}

I keep getting the reference error that contains is not defined. Am I using this method incorrectly?

noclist
  • 1,659
  • 2
  • 25
  • 66
  • Wouldn't that loop through all `.fas` that have a parent of `
  • ` ? I am trying to get the `
  • `'s themselves
  • – noclist Oct 18 '18 at 16:09
  • 1
    Your question is a bit ambiguous, but the query above returns all the `li`s that have class `fas`. Is that what you are looking for? – Andrei Cioara Oct 18 '18 at 16:10
  • 1
    No, I am trying to get all `li`s that have a descedant with a class of `.fas` – noclist Oct 18 '18 at 16:18