JSFiddle - React, Tailwind, and code Playground

HTML

<span>not so important</span>
  <span title="some specific text"><img src="/img/some.gif" /></span>
  <span title="more specific text">important 1</span>
  <span title="more specific text">important 2</span>
  <span title="more specific text">important 3</span>
  <span title="more specific text"><img src="/img/some.gif" /></span>
  <ul>
    <li>example 1</li>
    <li>example 2</li>
    <li>example 3</li>
  </ul>

CSS

ul {
    margin: 10px;
    padding: 20px;
    list-style-type: disc;
}

JavaScript

var ul = $('<ul/>');
    $('body').append(ul)
    $("span[title*='specific text']")
        .contents()
        .filter(function(){ return $(this).nodeType != 1; })
        .each(function(){
            ul.append('<li>' + $(this).text() + '</li>');
        })