-1

Is there a method in jQuery to find the each element that contains the first instance of a string?

<ul>
    <li>1</li> <-- find this
    <li>1</li>
    <li>1</li>
    <li>2</li> <-- find this
    <li>2</li>
    <li>3</li> <-- find this
    <li>3</li>
    <li>3</li>
    <li>3</li>
</ul>
univers_
  • 463
  • 1
  • 4
  • 14
  • 1
    Hmm.. What should be on the result? The node element for that `
  • ` element? Or just the node values (i.e an array like [1, 2, 3])?
  • – wentjun Jun 03 '19 at 03:10
  • The node element – univers_ Jun 03 '19 at 03:13
  • Best way you could probably do this is an iteration through nodes and an array of stored innerHTMLs – Sean Jun 03 '19 at 03:14
  • Possible duplicate of [JQuery: Remove duplicate elements?](https://stackoverflow.com/questions/2822962/jquery-remove-duplicate-elements) – Tyler Roper Jun 03 '19 at 03:30
  • Ther is not a built-in function in jQuery for this. You should probably re-design the part that builds this HTML if you can. – We Are All Monica Jun 03 '19 at 03:42