I have a div that pulls an excerpt from a post.
<div class="elementor-post__excerpt">
<div class=”youtube-player” data-id=”VnlwsUoyjYM”></div>
“They were going to unplug him.”
“They were going to unplug him,” Joy told us as she recalled why her mom contacted us in February 2015.
Joy’s dad, Odis, had been in a coma for six weeks…
</div>
Everything inside the container "elementor-post__excerpt" is text.
I need to remove the "<div class=”youtube-player” data-id=”VnlwsUoyjYM”></div>"
Each new excerpt will have a new youtube id, is there a way to remove the whole "<div class=”youtube-player” data-id=”VnlwsUoyjYM”></div>" if it contains "youtube-player" in it?
This code can check if it contains the word but not sure how to integrate it into removing the sentence if it contains a certain word.
var str = "Hello world";
var substr = "World";
var result = str.indexOf(substr) > -1;