In the block with id = "words", select the text hello world and add it to the block with id = "insert" in <span> instead of the string "abracadabra" here are the symbols
<html> <div id="words"> <p>что-то там...</p> <p>hello world</p> <!--вот это выбираем---> </div> <div id="insert"> <p>text <span>1</span> </p> <p>text <span>2</span> </p> <p>text 3 <span>abracadabra<!-- вот сюда вставляем--></span> </p> </html> <script> var y = $('#words').has(':contains("hello world")'); //выбрал hello world var z = $('div#insert').children().eq(3).has('span:contains("abracadabra")').append(y) //в итоге хрень получается </script>