How do I refer to the span that is in the li?

  • 0
    There is an li tag with a class volga, inside it are spans (there are many of them, so there is no specific number), one of which contains the text "Volga". How can I use js or jquery to refer to exactly the span that lies in li.volga?
    JavaScript Anonymous, Jul 7, 2019

  • 2 Answers
  • 0


  • 0
    const selector = "li.volga span"
    const txt = "волга"
    const elem = Array.from(document.querySelector(selector)).find(v => v.innerText.includes(txt))
    James Cantu

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!